]> git.ozlabs.org Git - ppp.git/commitdiff
device_script(): dont leak the dup'd in&out fds to scripts.
authorFrank Cusack <fcusack@fcusack.com>
Mon, 24 Feb 2003 11:26:57 +0000 (11:26 +0000)
committerFrank Cusack <fcusack@fcusack.com>
Mon, 24 Feb 2003 11:26:57 +0000 (11:26 +0000)
pppd/main.c

index 2c2b8a2fcd853a4267c734f3af24e2c48bfe8596..2c261e7c374c1dd6c36bb93c8f3259d02888e8a1 100644 (file)
@@ -40,7 +40,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: main.c,v 1.120 2002/12/04 23:03:32 paulus Exp $"
+#define RCSID  "$Id: main.c,v 1.121 2003/02/24 11:26:57 fcusack Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>
@@ -1455,8 +1455,12 @@ device_script(program, in, out, dont_wait)
     }
 
     /* dup in and out to fds > 2 */
     }
 
     /* dup in and out to fds > 2 */
+    fd = in;
     in = dup(in);
     in = dup(in);
+    close(fd);
+    fd = out;
     out = dup(out);
     out = dup(out);
+    close(fd);
     if (log_to_fd >= 0) {
        errfd = dup(log_to_fd);
     } else {
     if (log_to_fd >= 0) {
        errfd = dup(log_to_fd);
     } else {