qemu: Report binary path if error parsing -help

This commit is contained in:
Cole Robinson 2010-02-24 11:44:36 -05:00
parent 67b2eb1042
commit a09af3b004
3 changed files with 12 additions and 8 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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) {