aboutsummaryrefslogtreecommitdiff
path: root/src/rc
diff options
context:
space:
mode:
authorAlexander Zubkov <green@msu.ru>2018-08-24 17:42:15 +0200
committerWilliam Hubbs <w.d.hubbs@gmail.com>2018-12-04 16:53:39 -0600
commit9dae4f2e38ceae227933673e25db9583e8f610a6 (patch)
treecebb9d995a321e0e9be2c452fc34eb0f2d26f3f9 /src/rc
parentd126542dc626c8295b0f2cfcdee7bf5aa79daff1 (diff)
supervise-daemon: redirect std{in,out,err} to /dev/null after demonizing
This fixes #239.
Diffstat (limited to 'src/rc')
-rw-r--r--src/rc/supervise-daemon.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index 4def6823..0d477a54 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -982,6 +982,9 @@ int main(int argc, char **argv)
tty_fd = open("/dev/tty", O_RDWR);
#endif
devnull_fd = open("/dev/null", O_RDWR);
+ dup2(devnull_fd, STDIN_FILENO);
+ dup2(devnull_fd, STDOUT_FILENO);
+ dup2(devnull_fd, STDERR_FILENO);
child_pid = fork();
if (child_pid == -1)
eerrorx("%s: fork: %s", applet, strerror(errno));