]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_conf.c: also recognize new first line of qemu -help output
authorJim Meyering <meyering@redhat.com>
Thu, 20 May 2010 13:43:47 +0000 (15:43 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 20 May 2010 17:13:26 +0000 (19:13 +0200)
* 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.

src/qemu/qemu_conf.c

index d7bc7988c7d4e4f9964537bc9b784931ce90e793..be146fe8219ba99881d5a24980b96db32f38dd6e 100644 (file)
@@ -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);