[PATCH 3/3] Don't leak fds (#520154)

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

 



---
 iutil.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/iutil.py b/iutil.py
index 1f2c982..3422009 100644
--- a/iutil.py
+++ b/iutil.py
@@ -82,6 +82,8 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
         if not searchPath and not os.access (command, os.X_OK):
             raise RuntimeError, command + " can not be run"
 
+    stdinclose = stdoutclose = stderrclose = lambda : None
+
     argv = list(argv)
     if isinstance(stdin, str):
         if os.access(stdin, os.R_OK):
@@ -149,6 +151,9 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
         proc_err.join()
         del proc_err
 
+        stdinclose()
+        stdoutclose()
+        stderrclose()
     except OSError as e:
         errstr = "Error running %s: %s" % (command, e.strerror)
         log.error(errstr)
@@ -158,6 +163,10 @@ def execWithRedirect(command, argv, stdin = None, stdout = None,
         os.close(perrin)
         proc_std.join()
         proc_err.join()
+
+        stdinclose()
+        stdoutclose()
+        stderrclose()
         raise RuntimeError, errstr
 
     return ret
-- 
1.6.4.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux