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

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

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

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