]> git.ozlabs.org Git - ppp.git/commitdiff
set CLOCAL before running connector.
authorPaul Mackerras <paulus@samba.org>
Thu, 27 Nov 1997 06:09:20 +0000 (06:09 +0000)
committerPaul Mackerras <paulus@samba.org>
Thu, 27 Nov 1997 06:09:20 +0000 (06:09 +0000)
exit(1) on failure.

pppd/main.c

index ed73a12b0b9ccad87116fd3fc5940b8359e8cdde..1ad46a6b8ca3aa50c5da1b1af0d4ec8d6bf90f11 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: main.c,v 1.42 1997/07/14 03:53:25 paulus Exp $";
+static char rcsid[] = "$Id: main.c,v 1.43 1997/11/27 06:09:20 paulus Exp $";
 #endif
 
 #include <stdio.h>
 #endif
 
 #include <stdio.h>
@@ -161,7 +161,7 @@ main(argc, argv)
     int argc;
     char *argv[];
 {
     int argc;
     char *argv[];
 {
-    int i, nonblock, fdflags;
+    int i, fdflags;
     struct sigaction sa;
     FILE *pidfile;
     char *p;
     struct sigaction sa;
     FILE *pidfile;
     char *p;
@@ -449,18 +449,21 @@ main(argc, argv)
        } else
            tty_mode = statbuf.st_mode;
 
        } else
            tty_mode = statbuf.st_mode;
 
-       /*
-        * Set line speed, flow control, etc.
-        * Previously, if we had a connection script, we would set CLOCAL
-        * while the script was running.  But then, if CD was negated
-        * before the script finished, we would miss it.
-        */
-       set_up_tty(ttyfd, 0);
-
        /* run connection script */
        if (connector && connector[0]) {
            MAINDEBUG((LOG_INFO, "Connecting with <%s>", connector));
 
        /* run connection script */
        if (connector && connector[0]) {
            MAINDEBUG((LOG_INFO, "Connecting with <%s>", connector));
 
+           /*
+            * Set line speed, flow control, etc.
+            * On most systems we set CLOCAL for now so that we can talk
+            * to the modem before carrier comes up.  But this has the
+            * side effect that we might miss it if CD drops before we
+            * get to clear CLOCAL below.  On systems where we can talk
+            * successfully to the modem with CLOCAL clear and CD down,
+            * we can clear CLOCAL at this point.
+            */
+           set_up_tty(ttyfd, 1);
+
            /* drop dtr to hang up in case modem is off hook */
            if (!default_device && modem) {
                setdtr(ttyfd, FALSE);
            /* drop dtr to hang up in case modem is off hook */
            if (!default_device && modem) {
                setdtr(ttyfd, FALSE);
@@ -474,10 +477,14 @@ main(argc, argv)
                goto fail;
            }
 
                goto fail;
            }
 
+
            syslog(LOG_INFO, "Serial connection established.");
            sleep(1);           /* give it time to set up its terminal */
        }
 
            syslog(LOG_INFO, "Serial connection established.");
            sleep(1);           /* give it time to set up its terminal */
        }
 
+       /* set line speed, flow control, etc.; clear CLOCAL if modem option */
+       set_up_tty(ttyfd, 0);
+
        /* reopen tty if necessary to wait for carrier */
        if (connector == NULL && modem) {
            while ((i = open(devnam, O_RDWR)) < 0) {
        /* reopen tty if necessary to wait for carrier */
        if (connector == NULL && modem) {
            while ((i = open(devnam, O_RDWR)) < 0) {
@@ -579,7 +586,7 @@ main(argc, argv)
        }
 
        if (!persist)
        }
 
        if (!persist)
-           break;
+           die(1);
 
        if (demand)
            demand_discard();
 
        if (demand)
            demand_discard();