supervise-daemon: redirect std{in,out,err} to /dev/null after demonizing
This fixes #239.
This commit is contained in:
parent
d126542dc6
commit
9dae4f2e38
@ -982,6 +982,9 @@ int main(int argc, char **argv)
|
|||||||
tty_fd = open("/dev/tty", O_RDWR);
|
tty_fd = open("/dev/tty", O_RDWR);
|
||||||
#endif
|
#endif
|
||||||
devnull_fd = open("/dev/null", O_RDWR);
|
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();
|
child_pid = fork();
|
||||||
if (child_pid == -1)
|
if (child_pid == -1)
|
||||||
eerrorx("%s: fork: %s", applet, strerror(errno));
|
eerrorx("%s: fork: %s", applet, strerror(errno));
|
||||||
|
Loading…
Reference in New Issue
Block a user