提交 a09af3b0 编写于 作者: C Cole Robinson

qemu: Report binary path if error parsing -help

上级 67b2eb10
...@@ -1237,7 +1237,8 @@ static unsigned long long qemudComputeCmdFlags(const char *help, ...@@ -1237,7 +1237,8 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
#define SKIP_BLANKS(p) do { while ((*(p) == ' ') || (*(p) == '\t')) (p)++; } while (0) #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 long long *flags,
unsigned int *version, unsigned int *version,
unsigned int *is_kvm, unsigned int *is_kvm,
...@@ -1308,8 +1309,8 @@ fail: ...@@ -1308,8 +1309,8 @@ fail:
p = strndup(help, p - help); p = strndup(help, p - help);
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse QEMU version number in '%s'"), _("cannot parse %s version number in '%s'"),
p ? p : help); qemu, p ? p : help);
VIR_FREE(p); VIR_FREE(p);
...@@ -1340,12 +1341,13 @@ int qemudExtractVersionInfo(const char *qemu, ...@@ -1340,12 +1341,13 @@ int qemudExtractVersionInfo(const char *qemu,
enum { MAX_HELP_OUTPUT_SIZE = 1024*64 }; enum { MAX_HELP_OUTPUT_SIZE = 1024*64 };
int len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help); int len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help);
if (len < 0) { if (len < 0) {
virReportSystemError(errno, "%s", virReportSystemError(errno,
_("Unable to read QEMU help output")); _("Unable to read %s help output"), qemu);
goto cleanup2; 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; goto cleanup2;
if (retversion) if (retversion)
......
...@@ -175,7 +175,8 @@ int qemudExtractVersionInfo (const char *qemu, ...@@ -175,7 +175,8 @@ int qemudExtractVersionInfo (const char *qemu,
unsigned int *version, unsigned int *version,
unsigned long long *qemuCmdFlags); unsigned long long *qemuCmdFlags);
int qemudParseHelpStr (const char *str, int qemudParseHelpStr (const char *qemu,
const char *str,
unsigned long long *qemuCmdFlags, unsigned long long *qemuCmdFlags,
unsigned int *version, unsigned int *version,
unsigned int *is_kvm, unsigned int *is_kvm,
......
...@@ -49,7 +49,8 @@ static int testHelpStrParsing(const void *data) ...@@ -49,7 +49,8 @@ static int testHelpStrParsing(const void *data)
if (virtTestLoadFile(path, &help, MAX_HELP_OUTPUT_SIZE) < 0) if (virtTestLoadFile(path, &help, MAX_HELP_OUTPUT_SIZE) < 0)
return -1; 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; return -1;
if (flags != info->flags) { if (flags != info->flags) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册