From: Alexandr D. Kanevskiy Date: Tue, 23 Sep 2003 15:11:58 +0000 (+0000) Subject: fix a bug reported by Morgan Nelson. X-Git-Tag: ppp-2.4.7~275 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=3bea570b674a30512e6c47b20d05c6a9c2725590 fix a bug reported by Morgan Nelson. Confirmed on RedHat/ASPLinux 9 --- 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;