Run qemu with -help when probing for args

This commit is contained in:
Daniel P. Berrange 2008-05-21 19:43:39 +00:00
parent 8049357ded
commit 3af422a82e
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,8 @@
Wed May 21 15:42:29 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_conf.c: Run qemu with -help and don't pollute
libvirtd environment
Tue May 20 12:15:29 EST 2008 Daniel P. Berrange <berrange@redhat.com> Tue May 20 12:15:29 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* qemud/qemud.c: Re-factor daemon startup code to avoid * qemud/qemud.c: Re-factor daemon startup code to avoid

View File

@ -448,6 +448,9 @@ static int qemudExtractVersionInfo(const char *qemu, int *version, int *flags) {
} }
if (child == 0) { /* Kid */ if (child == 0) { /* Kid */
/* Just in case QEMU is translated someday we force to C locale.. */
const char *const qemuenv[] = { "LANG=C", NULL };
if (close(STDIN_FILENO) < 0) if (close(STDIN_FILENO) < 0)
goto cleanup1; goto cleanup1;
if (close(STDERR_FILENO) < 0) if (close(STDERR_FILENO) < 0)
@ -457,9 +460,9 @@ static int qemudExtractVersionInfo(const char *qemu, int *version, int *flags) {
if (dup2(newstdout[1], STDOUT_FILENO) < 0) if (dup2(newstdout[1], STDOUT_FILENO) < 0)
goto cleanup1; goto cleanup1;
/* Just in case QEMU is translated someday.. */ /* Passing -help, rather than relying on no-args which doesn't
setenv("LANG", "C", 1); always work */
execl(qemu, qemu, (char*)NULL); execle(qemu, qemu, "-help", (char*)NULL, qemuenv);
cleanup1: cleanup1:
_exit(-1); /* Just in case */ _exit(-1); /* Just in case */