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