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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Meyering wrote:
"Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
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.

Sounds obtuse enough to deserve a comment in the code.

In all fairness, it's never been well defined that the help script is outputted when no options are passed. It actually is machine dependent.

When the config file support is merged, and we introduce a default config, it will be possible to configure QEMU to default to -net tap and -boot cdn. In this case, a VM will be launched if no arguments are passed.

Regards,

Anthony Liguori

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 */

ACK


--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]