Re: [PATCH] introduce VIR_CLOSE to be used rather than close()

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

 



On 10/15/2010 11:12 AM, Laine Stump wrote:
in a multi-threaded system, I am introducing the VIR_CLOSE(fd) macro
to help
avoid mistakes here.

VIR_FREE() is commonly used in the way that Matthias describes, so I
think it would be consistent to use VIR_CLOSE in this way as well.

Invoking it unconditionally simplifies the code, and eliminates possible
confusion when someone adds new code and isn't sure which label they
should goto on failure (or maybe they think they are sure, but make the
wrong assumption, thus leading to a leaked fd as a result of trying to
eliminate possible double-closed fd's ;-)

I agree - the whole point of adding the macro is to make it so that we have a smaller maintenance burden - fewer labels is a good thing.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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