Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/
Date: Sat, 29 Apr 2017 22:56:13
Message-Id: 1493478736.06a6a27e441372164872c7712b80728527a6ec05.williamh@OpenRC
1 commit: 06a6a27e441372164872c7712b80728527a6ec05
2 Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
3 AuthorDate: Sat Apr 29 15:12:16 2017 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 29 15:12:16 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=06a6a27e
7
8 supervise-daemon: fix access to tty_fd and devnull_fd
9
10 Both the child and supervisor need access to these file descriptors.
11
12 src/rc/supervise-daemon.c | 10 ++++------
13 1 file changed, 4 insertions(+), 6 deletions(-)
14
15 diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
16 index 5636eaab..b13ec9e8 100644
17 --- a/src/rc/supervise-daemon.c
18 +++ b/src/rc/supervise-daemon.c
19 @@ -674,6 +674,10 @@ int main(int argc, char **argv)
20 if (child_pid != 0)
21 exit(EXIT_SUCCESS);
22
23 +#ifdef TIOCNOTTY
24 + tty_fd = open("/dev/tty", O_RDWR);
25 +#endif
26 + devnull_fd = open("/dev/null", O_RDWR);
27 child_pid = fork();
28 if (child_pid == -1)
29 eerrorx("%s: fork: %s", applet, strerror(errno));
30 @@ -682,12 +686,6 @@ int main(int argc, char **argv)
31 /* this is the supervisor */
32 umask(numask);
33
34 -#ifdef TIOCNOTTY
35 - tty_fd = open("/dev/tty", O_RDWR);
36 -#endif
37 -
38 - devnull_fd = open("/dev/null", O_RDWR);
39 -
40 fp = fopen(pidfile, "w");
41 if (! fp)
42 eerrorx("%s: fopen `%s': %s", applet, pidfile, strerror(errno));