From 25bd6734790c31d9f239ccac2aa1218ee071f6d0 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Fri, 12 Nov 2004 09:51:23 +0000 Subject: [PATCH] When using the notty option, close off stdin and stdout once the charshunt has been started. Also close off stderr unless it is the log_to_fd. --- pppd/tty.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pppd/tty.c b/pppd/tty.c index 30d4765..991a148 100644 --- a/pppd/tty.c +++ b/pppd/tty.c @@ -68,7 +68,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: tty.c,v 1.19 2004/11/06 05:42:29 paulus Exp $" +#define RCSID "$Id: tty.c,v 1.20 2004/11/12 09:51:23 paulus Exp $" #include #include @@ -644,6 +644,12 @@ int connect_tty() } else if (notty) { if (!start_charshunt(0, 1)) goto errret; + dup2(fd_devnull, 0); + dup2(fd_devnull, 1); + if (log_to_fd == 1) + log_to_fd = -1; + if (log_to_fd != 2) + dup2(fd_devnull, 2); } else if (record_file != NULL) { int fd = dup(ttyfd); if (!start_charshunt(fd, fd)) -- 2.39.2