Re: [libvirt] [PATCH 1/3] Re-factor qemu version parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2009-06-10 at 13:21 +0100, Daniel P. Berrange wrote:
> > +    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, &micro) != 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' ?

Nice catch Dan, thanks. Another version coming up which includes tests
for the flags computation, which would have caught this thinko.

Cheers,
Mark.

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]