[libvirt] [PATCHv2 9/9] phyp: another simplification

Eric Blake eblake at redhat.com
Fri Apr 15 21:12:42 UTC 2011


On 04/15/2011 03:01 PM, Matthias Bolte wrote:
>> +    str = phypExecBuffer(session, buf, &ret, conn, true);
>> +    if (!str || ret) {
>> +        VIR_FREE(str);
>> +        return -1;
>> +    }
>> +    ret = virStrToLong_i(str, NULL, 10, result);
> 
> You made the parsing stricter by passing NULL as second argument to
> virStrToLong_i. I don't expect it but this might be possible that this
> breaks the behavior of the driver.

That was an intentional decision of mine (I guess I should have
documented it better), since the rest of the code was getting the
character after the parsed integer but doing nothing with it.  In most
cases, it was like the code _expected_ a newline after the integer (such
as the output of a sed -c run, where that holds true), but wasn't
enforcing that expectation.

Should I modify the commit message and push with the newer strict
behavior, or modify the code to keep the older relaxed behavior (but
this time add a VIR_WARN if garbage is found after the parse)?

-- 
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: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110415/71304895/attachment-0001.sig>


More information about the libvir-list mailing list