From ad60737852c22a3c19c379bd94ecc76b80386f4f Mon Sep 17 00:00:00 2001 From: pali <7141871+pali@users.noreply.github.com> Date: Mon, 7 Jun 2021 13:11:43 +0200 Subject: [PATCH] pppd: Set restore_term at correct place (#284) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- pppd/sys-linux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index c05047c..2ede95f 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -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; } /******************************************************************** -- 2.39.2