提交 20beb0c0 编写于 作者: J Jim Meyering

qemu_conf.c: also recognize new first line of qemu -help output

* src/qemu/qemu_conf.c (QEMU_VERSION_STR_1, QEMU_VERSION_STR_2):
Define these instead of...
(QEMU_VERSION_STR): ... this.  Remove definition.
(qemudParseHelpStr): Check first for the new, shorter prefix,
"QEMU emulator version", and then for the old one,
"QEMU PC emulator version" when trying to parse the version number.
Based on a patch by Chris Wright.
上级 1f6fc519
......@@ -1246,7 +1246,9 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
/* We parse the output of 'qemu -help' to get the QEMU
* version number. The first bit is easy, just parse
* 'QEMU PC emulator version x.y.z'.
* 'QEMU PC emulator version x.y.z'
* or
* 'QEMU emulator version x.y.z'.
*
* With qemu-kvm, however, that is followed by a string
* in parenthesis as follows:
......@@ -1259,7 +1261,8 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
* and later, we just need the QEMU version number and
* whether it is KVM QEMU or mainline QEMU.
*/
#define QEMU_VERSION_STR "QEMU PC emulator version"
#define QEMU_VERSION_STR_1 "QEMU emulator version"
#define QEMU_VERSION_STR_2 "QEMU PC emulator version"
#define QEMU_KVM_VER_PREFIX "(qemu-kvm-"
#define KVM_VER_PREFIX "(kvm-"
......@@ -1277,11 +1280,13 @@ int qemudParseHelpStr(const char *qemu,
*flags = *version = *is_kvm = *kvm_version = 0;
if (!STRPREFIX(p, QEMU_VERSION_STR))
if (STRPREFIX(p, QEMU_VERSION_STR_1))
p += strlen(QEMU_VERSION_STR_1);
else if (STRPREFIX(p, QEMU_VERSION_STR_2))
p += strlen(QEMU_VERSION_STR_2);
else
goto fail;
p += strlen(QEMU_VERSION_STR);
SKIP_BLANKS(p);
major = virParseNumber(&p);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册