supervise-daemon: fix access to tty_fd and devnull_fd
Both the child and supervisor need access to these file descriptors.
This commit is contained in:
parent
5de3798afc
commit
06a6a27e44
@ -674,6 +674,10 @@ int main(int argc, char **argv)
|
|||||||
if (child_pid != 0)
|
if (child_pid != 0)
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
|
#ifdef TIOCNOTTY
|
||||||
|
tty_fd = open("/dev/tty", O_RDWR);
|
||||||
|
#endif
|
||||||
|
devnull_fd = open("/dev/null", O_RDWR);
|
||||||
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));
|
||||||
@ -682,12 +686,6 @@ int main(int argc, char **argv)
|
|||||||
/* this is the supervisor */
|
/* this is the supervisor */
|
||||||
umask(numask);
|
umask(numask);
|
||||||
|
|
||||||
#ifdef TIOCNOTTY
|
|
||||||
tty_fd = open("/dev/tty", O_RDWR);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
devnull_fd = open("/dev/null", O_RDWR);
|
|
||||||
|
|
||||||
fp = fopen(pidfile, "w");
|
fp = fopen(pidfile, "w");
|
||||||
if (! fp)
|
if (! fp)
|
||||||
eerrorx("%s: fopen `%s': %s", applet, pidfile, strerror(errno));
|
eerrorx("%s: fopen `%s': %s", applet, pidfile, strerror(errno));
|
||||||
|
Loading…
Reference in New Issue
Block a user