Re: [PATCH RESEND] command: avoid fd leak on failure

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

 



On 10/13/2011 03:03 AM, Daniel Veillard wrote:
On Wed, Oct 12, 2011 at 05:59:40PM -0600, Eric Blake wrote:
virCommandTransferFD promises that the fd is no longer owned by
the caller.  Normally, we want the fd to remain open until the
child runs, but in error situations, we must close it earlier.

* src/util/command.c (virCommandTransferFD): Close fd now if we
can't track it to close later.
(virCommandKeepFD): Adjust helper to make this easier.
---

This leak can only happen on OOM or other extreme error conditions,
but ought to be plugged.  When I originally posted this:
https://www.redhat.com/archives/libvir-list/2011-July/msg00674.html
DV was worried that callers might abuse things and use fd
even after this function closed it; but I proved to myself in
writing a (non-working) v2 that all callers were already safe,
and that this v1 was indeed a smaller solution.

   Okidoc then :-)


   ACK,

Thanks; pushed.

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