]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
leave tty with echo turned off if not default device
[ppp.git] / pppd / sys-linux.c
index 946a2f93033eb5e377208ba9e046bb8c0c36f3b7..9f04976e5b810139a04228e73a8b8e4bf2b68853 100644 (file)
@@ -399,6 +399,15 @@ void setdtr (int fd, int on)
 void restore_tty (void)
 {
     if (restore_term) {
+       if (!default_device) {
+           /*
+            * Turn off echoing, because otherwise we can get into
+            * a loop with the tty and the modem echoing to each other.
+            * We presume we are the sole user of this tty device, so
+            * when we close it, it will revert to its defaults anyway.
+            */
+           inittermios.c_lflag &= ~(ECHO | ECHONL);
+       }
        if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
            if (errno != ENXIO)
                syslog(LOG_WARNING, "tcsetattr: %m");