On 07/23/2012 09:22 AM, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > When running directly from GIT, libvirtd attempts to locate > the directory containing loadable modules. This currently > only works if executing libvirtd with a CWD inside the libvirt > source tree. Switch to locate based on the path to the current > binary instead > --- > daemon/libvirtd.c | 24 +++++++++++++++++++++--- > 1 file changed, 21 insertions(+), 3 deletions(-) > > diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c > index b5c0102..a7bb9dd 100644 > --- a/daemon/libvirtd.c > +++ b/daemon/libvirtd.c > @@ -972,9 +972,27 @@ int main(int argc, char **argv) { > virLogSetFromEnv(); > > #ifdef WITH_DRIVER_MODULES > - if (strstr(argv[0], "lt-libvirtd") && > - (access("./.git", R_OK) >= 0 || access("../.git", R_OK) >= 0)) > - virDriverModuleInitialize("./src/.libs"); > + if (strstr(argv[0], "lt-libvirtd")) { > + char *tmp = strrchr(argv[0], '/'); > + if (!tmp) { > + fprintf(stderr, _("%s: cannot identify driver directory\n"), argv[0]); > + exit(EXIT_FAILURE); > + } > + *tmp = '\0'; Modifying argv in-place - fun stuff. I'm not sure if it is technically kosher by C99 rules, but it works and I'm not going to be a stickler. ACK - this addresses one of my findings from when you first introduced this test. -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list