]> git.ozlabs.org Git - ppp.git/commitdiff
don't set CLOCAL when running connector
authorPaul Mackerras <paulus@samba.org>
Mon, 14 Jul 1997 03:53:25 +0000 (03:53 +0000)
committerPaul Mackerras <paulus@samba.org>
Mon, 14 Jul 1997 03:53:25 +0000 (03:53 +0000)
pppd/main.c

index 2f17a69ed0d6933a3f2bfcbfdb374249cbc2f1b8..ed73a12b0b9ccad87116fd3fc5940b8359e8cdde 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: main.c,v 1.41 1997/04/30 05:54:52 paulus Exp $";
+static char rcsid[] = "$Id: main.c,v 1.42 1997/07/14 03:53:25 paulus Exp $";
 #endif
 
 #include <stdio.h>
@@ -449,13 +449,18 @@ main(argc, argv)
        } 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));
 
-           /* set line speed, flow control, etc.; set CLOCAL for now */
-           set_up_tty(ttyfd, 1);
-
            /* drop dtr to hang up in case modem is off hook */
            if (!default_device && modem) {
                setdtr(ttyfd, FALSE);
@@ -473,15 +478,12 @@ main(argc, argv)
            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) {
                if (errno != EINTR)
                    syslog(LOG_ERR, "Failed to reopen %s: %m", devnam);
-               if (!persist || errno != EINTR)
+               if (!persist || errno != EINTR || hungup || kill_link)
                    goto fail;
            }
            close(i);