]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/main.c
Allow *-max-terminate to be set to zero -- meaning that one Terminate-
[ppp.git] / pppd / main.c
index 8511503f78aa8296ac839df7728bb161542d82c7..6e50947000ed65e620bb12089582ef306bf54fc0 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.127 2003/05/12 07:31:36 fcusack Exp $"
+#define RCSID  "$Id: main.c,v 1.132 2004/02/02 02:52:51 carlsonj Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
@@ -74,7 +74,7 @@
 #include "ipv6cp.h"
 #endif
 #include "upap.h"
-#include "chap.h"
+#include "chap-new.h"
 #include "eap.h"
 #include "ccp.h"
 #include "ecp.h"
@@ -589,7 +589,8 @@ main(argc, argv)
         */
     disconnect:
        new_phase(PHASE_DISCONNECT);
-       the_channel->disconnect();
+       if (the_channel->disconnect)
+           the_channel->disconnect();
 
     fail:
        if (the_channel->cleanup)
@@ -1172,6 +1173,7 @@ print_link_stats()
        info("Connect time %d.%d minutes.", t/10, t%10);
        info("Sent %u bytes, received %u bytes.",
            link_stats.bytes_out, link_stats.bytes_in);
+       link_stats_valid = 0;
     }
 }
 
@@ -1337,8 +1339,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 +1505,7 @@ device_script(program, in, out, dont_wait)
     int pid;
     int status = -1;
     int errfd;
+    int fd;
 
     ++conn_running;
     pid = safe_fork();
@@ -1530,6 +1533,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;