[PATCH 14/17] Close file descriptors while daemonizing auditd

David Shea dshea at redhat.com
Sun Sep 21 19:37:06 UTC 2014


This way parent processes don't try waiting for output that will never
come.
---
 pyanaconda/isys/auditd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pyanaconda/isys/auditd.c b/pyanaconda/isys/auditd.c
index a75289c..dfe6ad4 100644
--- a/pyanaconda/isys/auditd.c
+++ b/pyanaconda/isys/auditd.c
@@ -107,6 +107,11 @@ int audit_daemonize(void) {
     if (child < 0)
         return -1;
 
+    /* Close stdin and friends */
+    close(STDIN_FILENO);
+    close(STDOUT_FILENO);
+    close(STDERR_FILENO);
+
     if ((fd = open("/proc/self/oom_score_adj", O_RDWR)) >= 0) {
         write(fd, "-1000", 5);
         close(fd);
-- 
1.9.3



More information about the anaconda-patches mailing list