From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 29039139694 for ; Sat, 29 Apr 2017 22:56:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B9D2EE0DCA; Sat, 29 Apr 2017 22:56:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 96113E0DC8 for ; Sat, 29 Apr 2017 22:56:11 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6646D34105A for ; Sat, 29 Apr 2017 22:56:10 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 538B3730C for ; Sat, 29 Apr 2017 22:56:08 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1493478736.06a6a27e441372164872c7712b80728527a6ec05.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/supervise-daemon.c X-VCS-Directories: src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 06a6a27e441372164872c7712b80728527a6ec05 X-VCS-Branch: master Date: Sat, 29 Apr 2017 22:56:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8559c324-5852-40d0-a014-045cf2a2a9f7 X-Archives-Hash: d24f23b571252304c72044b8c009660e commit: 06a6a27e441372164872c7712b80728527a6ec05 Author: William Hubbs gmail com> AuthorDate: Sat Apr 29 15:12:16 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Sat Apr 29 15:12:16 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=06a6a27e supervise-daemon: fix access to tty_fd and devnull_fd Both the child and supervisor need access to these file descriptors. src/rc/supervise-daemon.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c index 5636eaab..b13ec9e8 100644 --- a/src/rc/supervise-daemon.c +++ b/src/rc/supervise-daemon.c @@ -674,6 +674,10 @@ int main(int argc, char **argv) if (child_pid != 0) exit(EXIT_SUCCESS); +#ifdef TIOCNOTTY + tty_fd = open("/dev/tty", O_RDWR); +#endif + devnull_fd = open("/dev/null", O_RDWR); child_pid = fork(); if (child_pid == -1) eerrorx("%s: fork: %s", applet, strerror(errno)); @@ -682,12 +686,6 @@ int main(int argc, char **argv) /* this is the supervisor */ umask(numask); -#ifdef TIOCNOTTY - tty_fd = open("/dev/tty", O_RDWR); -#endif - - devnull_fd = open("/dev/null", O_RDWR); - fp = fopen(pidfile, "w"); if (! fp) eerrorx("%s: fopen `%s': %s", applet, pidfile, strerror(errno));