[libvirt] PATCH: Use -help arg with QEMU probing

Daniel P. Berrange berrange at redhat.com
Fri May 16 14:36:53 UTC 2008


This patch makes the code that probes QEMU args explicitly add the -help
argument. This works around a problem with certain KVM builds which refuse
to run if executed without -help, and no KVM modules are present.

It also removes the set of setenv() since that changes libvirtd's environ
and instead uses execle() to set the child's environment


Dan

Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.64
diff -u -p -r1.64 qemu_conf.c
--- src/qemu_conf.c	15 May 2008 20:07:34 -0000	1.64
+++ src/qemu_conf.c	16 May 2008 14:34:42 -0000
@@ -447,6 +447,8 @@ static int qemudExtractVersionInfo(const
     }
 
     if (child == 0) { /* Kid */
+        const char *const qemuenv[] = { "LANG=C", NULL };
+
         if (close(STDIN_FILENO) < 0)
             goto cleanup1;
         if (close(STDERR_FILENO) < 0)
@@ -457,8 +459,7 @@ static int qemudExtractVersionInfo(const
             goto cleanup1;
 
         /* Just in case QEMU is translated someday.. */
-        setenv("LANG", "C", 1);
-        execl(qemu, qemu, (char*)NULL);
+        execle(qemu, qemu, "-help", (char*)NULL, qemuenv);
 
     cleanup1:
         _exit(-1); /* Just in case */

-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list