]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/main.c
bugfix from Erich Schubert (erich at debian.org)
[ppp.git] / pppd / main.c
index 640782ad6f35d03b02f08d583733669734943acd..86315662b0611ba6b7d62434ee8b380e9c10396b 100644 (file)
@@ -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.130 2003/12/17 08:56:05 kad Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
@@ -1337,8 +1337,8 @@ kill_my_pg(sig)
 
     act.sa_handler = SIG_IGN;
     act.sa_flags = 0;
-    kill(0, sig);
     sigaction(sig, &act, &oldact);
+    kill(0, sig);
     sigaction(sig, &oldact, NULL);
 }
 
@@ -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;