1 |
commit: 47cf1d0c707dc88d216bebc15be3f39d5eb47fa9 |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Apr 29 17:04:15 2017 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 29 17:04:15 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=47cf1d0c |
7 |
|
8 |
supervise-daemon:remove the controlling tty in the supervisor |
9 |
|
10 |
src/rc/supervise-daemon.c | 7 +++++++ |
11 |
1 file changed, 7 insertions(+) |
12 |
|
13 |
diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c |
14 |
index b13ec9e8..2a24799c 100644 |
15 |
--- a/src/rc/supervise-daemon.c |
16 |
+++ b/src/rc/supervise-daemon.c |
17 |
@@ -226,6 +226,7 @@ static void child_process(char *exec, char **argv) |
18 |
/* Close any fd's to the passwd database */ |
19 |
endpwent(); |
20 |
|
21 |
+ /* remove the controlling tty */ |
22 |
#ifdef TIOCNOTTY |
23 |
ioctl(tty_fd, TIOCNOTTY, 0); |
24 |
close(tty_fd); |
25 |
@@ -696,6 +697,12 @@ int main(int argc, char **argv) |
26 |
rc_service_daemon_set(svcname, exec, |
27 |
(const char * const *) argv, pidfile, true); |
28 |
|
29 |
+ /* remove the controlling tty */ |
30 |
+#ifdef TIOCNOTTY |
31 |
+ ioctl(tty_fd, TIOCNOTTY, 0); |
32 |
+ close(tty_fd); |
33 |
+#endif |
34 |
+ |
35 |
/* |
36 |
* Supervisor main loop |
37 |
*/ |