From 3bea570b674a30512e6c47b20d05c6a9c2725590 Mon Sep 17 00:00:00 2001 From: "Alexandr D. Kanevskiy" Date: Tue, 23 Sep 2003 15:11:58 +0000 Subject: [PATCH] fix a bug reported by Morgan Nelson. Confirmed on RedHat/ASPLinux 9 --- pppd/main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pppd/main.c b/pppd/main.c index 640782a..4171acc 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -40,7 +40,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: main.c,v 1.128 2003/06/11 23:56:26 paulus Exp $" +#define RCSID "$Id: main.c,v 1.129 2003/09/23 15:11:58 kad Exp $" #include #include @@ -1503,6 +1503,7 @@ device_script(program, in, out, dont_wait) int pid; int status = -1; int errfd; + int fd; ++conn_running; pid = safe_fork(); @@ -1530,6 +1531,14 @@ device_script(program, in, out, dont_wait) /* here we are executing in the child */ + /* make sure fds 0, 1, 2 are occupied */ + while ((fd = dup(in)) >= 0) { + if (fd > 2) { + close(fd); + break; + } + } + /* dup in and out to fds > 2 */ { int fd1 = in, fd2 = out, fd3 = log_to_fd; -- 2.39.2