Fix deadlock bug when daemonizing
[mspang/pyceo.git] / src / dmaster.c
index 45331c8..2e99c57 100644 (file)
@@ -102,9 +102,9 @@ static void setup_daemon(void) {
 
         setup_pidfile();
 
-        close(STDIN_FILENO);
-        close(STDOUT_FILENO);
-        close(STDERR_FILENO);
+        freopen("/dev/null", "r", stdin);
+        freopen("/dev/null", "w", stdout);
+        freopen("/dev/null", "w", stderr);
     }
 }