From: pali <7141871+pali@users.noreply.github.com> Date: Mon, 7 Jun 2021 11:11:43 +0000 (+0200) Subject: pppd: Set restore_term at correct place (#284) X-Git-Tag: ppp-2.5.0~75 X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=ad60737852c22a3c19c379bd94ecc76b80386f4f;p=ppp.git pppd: Set restore_term at correct place (#284) 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 --- 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; } /********************************************************************