[netcf-devel] [PATCH] Better messages on failure reading /sys/class/net/$dev/(operstate|speed)

Eric Blake eblake at redhat.com
Tue Jan 27 04:37:09 UTC 2015


On 01/26/2015 07:00 PM, Laine Stump wrote:
> On 01/26/2015 06:04 PM, Eric Blake wrote:
>> On 01/26/2015 02:56 PM, Laine Stump wrote:
>>> add_link_info() sets an error message when it fails to read
>>> /sys/class/net/$dev/operstate, but unfortunately frees the path string
>>> just prior to setting the error message, so the error string has
>>> "(null)" instead (thanks to glibc's asprintf noticing the null
>>> pointer).

>>> -    ERR_THROW_STRERROR(!state, ncf, EFILE, "Failed to read %s", path);
>>> +    ERR_THROW_STRERROR(!state, ncf, EFILE, "Failed to read %s : %s",
>>> +                       path, strerror);
>> 'strerror' is the address of a function - printing that as a string is
>> probably quite the wrong thing to do.  I think you want 'errbuf' here.
> 
> Oops. Yeah, that's what my mind was thinking, but my fingers were in a
> hurry. Proof once again that it's never good to push without a review.

> I assume ACK once I fix the bonehead finger fumble?

Yes, the rest looks good, so consider this as ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <https://lists.fedorahosted.org/pipermail/netcf-devel/attachments/20150126/61be641e/attachment.sig>


More information about the netcf-devel mailing list