[libvirt] [PATCHv2 10/10] Replace sscanf in PCI device address parsing
Eric Blake
eblake at redhat.com
Wed Mar 31 22:44:59 UTC 2010
On 03/31/2010 03:42 PM, Matthias Bolte wrote:
> This also fixes a problem with MinGW's GCC on Windows.
> GCC complained about the L modifier being unknown.
>
> Parsing is stricter now and doesn't accept trailing characters
> after the actual value anymore.
>
> + /* expected format: <start>-<end> : <domain>:<bus>:<slot>.<function> */
> + if (/* start */
> + virStrToLong_ull(tmp, &tmp, 16, &start) < 0 || *tmp != '-' ||
> + /* end */
> + virStrToLong_ull(tmp + 1, &tmp, 16, &end) < 0 ||
> + (tmp = STRSKIP(tmp, " : ")) == NULL ||
> + /* domain */
> + virStrToLong_ui(tmp, &tmp, 16, &domain) < 0 || *tmp != ':' ||
> + /* bus */
> + virStrToLong_ui(tmp + 1, &tmp, 16, &bus) < 0 || *tmp != ':' ||
> + /* slot */
> + virStrToLong_ui(tmp + 1, &tmp, 16, &slot) < 0 || *tmp != '.' ||
> + /* function */
> + virStrToLong_ui(tmp + 1, &tmp, 16, &function) < 0)
> continue;
According to your commit comments, shouldn't you use NULL instead of
&tmp in that last virStrToLong_ui?
ACK, possibly after tweaking that line.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100331/0c5ef98e/attachment-0001.sig>
More information about the libvir-list
mailing list