Browse files

xlshd now closes standard fds even in foreground (nodaemon) mode.

  • Loading branch information...
1 parent 50d8d29 commit ee75002e5fe6164e6200ba585168659216650182 @Nadrin committed Oct 14, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/xlshd.c
View
8 src/xlshd.c
@@ -74,10 +74,6 @@ void xlshd_daemonize(const char* argv0)
if(setsid() < 0)
exit(EXIT_FAILURE);
- stdin = freopen("/dev/null", "r", stdin);
- stdout = freopen("/dev/null", "w", stdout);
- stderr = freopen("/dev/null", "w", stderr);
-
kill(getppid(), SIGUSR1);
}
@@ -126,6 +122,10 @@ int main(int argc, char** argv)
xlshd_daemonize(argv[0]);
libxlsh_pid_lock(XLSHD_PIDFILE, getpid(), XLSH_OVERWRITE);
}
+
+ stdin = freopen("/dev/null", "r", stdin);
+ stdout = freopen("/dev/null", "w", stdout);
+ stderr = freopen("/dev/null", "w", stderr);
libxlsh_proc_sigmask();

0 comments on commit ee75002

Please sign in to comment.