supervise-daemon: redirect std{in,out,err} to /dev/null after demonizing

This fixes #239.
This commit is contained in:
Alexander Zubkov 2018-08-24 17:42:15 +02:00 committed by William Hubbs
parent d126542dc6
commit 9dae4f2e38

View File

@ -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));