]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/tty.c
Stop the charshunt process after running the disconnector,
[ppp.git] / pppd / tty.c
index 85a80323c7f40414d7f364f905aacd59716b796c..1ef8a52eacae3bf8a6560005c2659214e1186622 100644 (file)
@@ -68,7 +68,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: tty.c,v 1.21 2004/11/13 12:05:48 paulus Exp $"
+#define RCSID  "$Id: tty.c,v 1.24 2005/07/12 01:09:05 paulus Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
@@ -445,7 +445,12 @@ tty_check_options()
        struct stat statbuf;
        int fdflags;
 
-       if (demand && connect_script == 0) {
+       if (demand && notty) {
+               option_error("demand-dialling is incompatible with notty");
+               exit(EXIT_OPTION_ERROR);
+       }
+       if (demand && connect_script == 0 && ptycommand == NULL
+           && pty_socket == NULL) {
                option_error("connect script is required for demand-dialling\n");
                exit(EXIT_OPTION_ERROR);
        }
@@ -740,7 +745,7 @@ int connect_tty()
         * time for something from the peer.  This can avoid bouncing
         * our packets off his tty before he has it set up.
         */
-       if (connector != NULL || ptycommand != NULL)
+       if (connector != NULL || ptycommand != NULL || pty_socket != NULL)
                listen_time = connect_delay;
 
        return ttyfd;
@@ -750,14 +755,6 @@ int connect_tty()
                close(pty_master);
                pty_master = -1;
        }
-       if (pty_slave >= 0) {
-               close(pty_slave);
-               pty_slave = -1;
-       }
-       if (real_ttyfd >= 0) {
-               close(real_ttyfd);
-               real_ttyfd = -1;
-       }
        ttyfd = -1;
        if (got_sigterm)
                asked_to_quit = 1;
@@ -776,6 +773,7 @@ void disconnect_tty()
        } else {
                info("Serial link disconnected.");
        }
+       stop_charshunt(NULL, 0);
 }
 
 void tty_close_fds()
@@ -939,7 +937,6 @@ start_charshunt(ifd, ofd)
        exit(0);
     }
     charshunt_pid = cpid;
-    add_notifier(&sigreceived, stop_charshunt, 0);
     record_child(cpid, "pppd (charshunt)", charshunt_done, NULL);
     return 1;
 }