Re: [PATCH] virsh-nodedev: Avoid spurious errors

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

 



On 06/02/2014 08:52 AM, Michal Privoznik wrote:
> Our public free functions explicitly don't accept NULL pointers
> (sigh). Therefore, callers must do something like this:
> 
>     if (dev)
>         virNodeDeviceFree(dev);

Back-compat stinks - changing an error into silent success may break
older code that was relying on the error, so I'm not brave enough to
change the public API.

I wonder if it would be appropriate to annotate our public API with
non-NULL markers, so that at least the compiler could warn on calls to
the API with a NULL pointer.

> 
> And we are not doing that on two places I've found. This leads to
> dummy error message thrown by virsh:
> 
>     virsh # nodedev-dumpxml nonexistent-device
>     error: Could not find matching device 'nonexistent-device'
>     error: invalid node device pointer in virNodeDeviceFree
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  tools/virsh-nodedev.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

At any rate, whether or not we choose to make further changes to
libvirt.h, your patch is stand-alone correct. ACK.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]