From a09af3b004e2a12045957e377f27c4cd436f0bd4 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 24 Feb 2010 11:44:36 -0500 Subject: [PATCH] qemu: Report binary path if error parsing -help --- src/qemu/qemu_conf.c | 14 ++++++++------ src/qemu/qemu_conf.h | 3 ++- tests/qemuhelptest.c | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index e3da08a561..1f8a9c341c 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1237,7 +1237,8 @@ static unsigned long long qemudComputeCmdFlags(const char *help, #define SKIP_BLANKS(p) do { while ((*(p) == ' ') || (*(p) == '\t')) (p)++; } while (0) -int qemudParseHelpStr(const char *help, +int qemudParseHelpStr(const char *qemu, + const char *help, unsigned long long *flags, unsigned int *version, unsigned int *is_kvm, @@ -1308,8 +1309,8 @@ fail: p = strndup(help, p - help); qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse QEMU version number in '%s'"), - p ? p : help); + _("cannot parse %s version number in '%s'"), + qemu, p ? p : help); VIR_FREE(p); @@ -1340,12 +1341,13 @@ int qemudExtractVersionInfo(const char *qemu, enum { MAX_HELP_OUTPUT_SIZE = 1024*64 }; int len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help); if (len < 0) { - virReportSystemError(errno, "%s", - _("Unable to read QEMU help output")); + virReportSystemError(errno, + _("Unable to read %s help output"), qemu); goto cleanup2; } - if (qemudParseHelpStr(help, &flags, &version, &is_kvm, &kvm_version) == -1) + if (qemudParseHelpStr(qemu, help, &flags, + &version, &is_kvm, &kvm_version) == -1) goto cleanup2; if (retversion) diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index ae187dc6e5..c8757c53a1 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -175,7 +175,8 @@ int qemudExtractVersionInfo (const char *qemu, unsigned int *version, unsigned long long *qemuCmdFlags); -int qemudParseHelpStr (const char *str, +int qemudParseHelpStr (const char *qemu, + const char *str, unsigned long long *qemuCmdFlags, unsigned int *version, unsigned int *is_kvm, diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 0f2b509b48..ad355d7eb9 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -49,7 +49,8 @@ static int testHelpStrParsing(const void *data) if (virtTestLoadFile(path, &help, MAX_HELP_OUTPUT_SIZE) < 0) return -1; - if (qemudParseHelpStr(help, &flags, &version, &is_kvm, &kvm_version) == -1) + if (qemudParseHelpStr("QEMU", help, &flags, + &version, &is_kvm, &kvm_version) == -1) return -1; if (flags != info->flags) {