Re: [PATCH] virFDStream: close also given errfd (fd leak)

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

 



On 10/13/2011 05:47 AM, Marc-André Lureau wrote:
In virFDStreamOpenFileInternal(), a errfd pipe is opened by
virCommandRunAsync() and given to virFDStreamOpenInternal().

It seems virFDStream should close errfd, just like the other
fd it is given.

This fixes screenshots leaking FDs:
http://bugzilla.redhat.com/show_bug.cgi?id=745761
---
  src/fdstream.c |    4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/fdstream.c b/src/fdstream.c
index b60162c..841f979 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -268,6 +268,10 @@ virFDStreamClose(virStreamPtr st)
          virCommandFree(fdst->cmd);
          fdst->cmd = NULL;
      }
+
+    if (VIR_CLOSE(fdst->errfd)<  0)
+        VIR_DEBUG("ignoring failed close on fd %d", fdst->errfd);
+

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