From 9dae4f2e38ceae227933673e25db9583e8f610a6 Mon Sep 17 00:00:00 2001 From: Alexander Zubkov Date: Fri, 24 Aug 2018 17:42:15 +0200 Subject: supervise-daemon: redirect std{in,out,err} to /dev/null after demonizing This fixes #239. --- src/rc/supervise-daemon.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/rc/supervise-daemon.c') 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)); -- cgit v1.2.3