On Wed, Jun 10, 2009 at 01:17:35PM +0100, Mark McLoughlin wrote: > This patch is purely re-factoring without any functional changes > to make way for the next patch. > > The main thing achieved by the refactoring is that we now have > easier access to the parenthesised string that KVM folks seem > to delight in changing. > > int qemudExtractVersionInfo(const char *qemu, > unsigned int *retversion, > @@ -421,7 +488,6 @@ int qemudExtractVersionInfo(const char *qemu, > pid_t child; > int newstdout = -1; > int ret = -1, status; > - unsigned int major, minor, micro; > unsigned int version, kvm_version; > unsigned int flags = 0; > > @@ -443,22 +509,11 @@ int qemudExtractVersionInfo(const char *qemu, > goto cleanup2; > } > > - if (sscanf(help, "QEMU PC emulator version %u.%u.%u (kvm-%u)", > - &major, &minor, µ, &kvm_version) != 4) > - kvm_version = 0; > + char *eol = strchr(help, '\n'); > + if (eol) *eol = '\0'; IIUC this NULL terminates the 'help' string on the first line, which will surely break.... > > - if (!kvm_version && > - sscanf(help, "QEMU PC emulator version %u.%u.%u", > - &major, &minor, µ) != 3) { > - char *eol = strchr(help, '\n'); > - if (eol) *eol = '\0'; > - qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, > - _("cannot parse QEMU version number in '%s'"), > - help); > + if (qemudParseVersionStr(help, &version, &kvm_version) == -1) > goto cleanup2; > - } > - > - version = (major * 1000 * 1000) + (minor * 1000) + micro; > > if (strstr(help, "-no-kqemu")) > flags |= QEMUD_CMD_FLAG_KQEMU; ....this code which looks at subsequent lines of 'help' ? Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list