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

Re: [libvirt] [PATCHv2 10/10] Replace sscanf in PCI device address parsing



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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