supervise-daemon:remove the controlling tty in the supervisor

This commit is contained in:
William Hubbs 2017-04-29 12:04:15 -05:00
parent 06a6a27e44
commit 47cf1d0c70

View File

@ -226,6 +226,7 @@ static void child_process(char *exec, char **argv)
/* Close any fd's to the passwd database */ /* Close any fd's to the passwd database */
endpwent(); endpwent();
/* remove the controlling tty */
#ifdef TIOCNOTTY #ifdef TIOCNOTTY
ioctl(tty_fd, TIOCNOTTY, 0); ioctl(tty_fd, TIOCNOTTY, 0);
close(tty_fd); close(tty_fd);
@ -696,6 +697,12 @@ int main(int argc, char **argv)
rc_service_daemon_set(svcname, exec, rc_service_daemon_set(svcname, exec,
(const char * const *) argv, pidfile, true); (const char * const *) argv, pidfile, true);
/* remove the controlling tty */
#ifdef TIOCNOTTY
ioctl(tty_fd, TIOCNOTTY, 0);
close(tty_fd);
#endif
/* /*
* Supervisor main loop * Supervisor main loop
*/ */