]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Set restore_term at correct place (#284)
authorpali <7141871+pali@users.noreply.github.com>
Mon, 7 Jun 2021 11:11:43 +0000 (13:11 +0200)
committerGitHub <noreply@github.com>
Mon, 7 Jun 2021 11:11:43 +0000 (21:11 +1000)
After successful call to tcsetattr/TCSAFLUSH it is needed to restore
terminal at the end. So set restore_term variable at correct place. Fixes
issue that fatal() call after tcsetattr/TCSAFLUSH does not restore terminal
settings.

Signed-off-by: Pali Rohár <pali@kernel.org>
pppd/sys-linux.c

index c05047c765c1d6cad5e1cf38ce9897850d8a9658..2ede95f7566906a31f748e74d7021a12a7329005 100644 (file)
@@ -1058,6 +1058,7 @@ void set_up_tty(int tty_fd, int local)
     while (tcsetattr(tty_fd, TCSAFLUSH, &tios) < 0 && !ok_error(errno))
        if (errno != EINTR)
            fatal("tcsetattr: %m (line %d)", __LINE__);
+    restore_term = 1;
 
 /* Most Linux architectures and drivers support arbitrary baud rate values via BOTHER */
 #ifdef TCGETS2
@@ -1091,8 +1092,6 @@ void set_up_tty(int tty_fd, int local)
        else
            fatal("Baud rate for %s is 0; need explicit baud rate", devnam);
     }
-
-    restore_term = 1;
 }
 
 /********************************************************************