Use TCSAFLUSH when restoring terminal settings (and echo) to guarantee that any pending output is discarded
This commit is contained in:
@@ -107,8 +107,6 @@ __unused static const char rcsid[] = "$Sudo$";
|
||||
# define tcsetattr(f, a, t) ioctl(f, a, t)
|
||||
# undef TCSAFLUSH
|
||||
# define TCSAFLUSH TCSETAF
|
||||
# undef TCSANOW
|
||||
# define TCSANOW TCSETA
|
||||
# else
|
||||
# undef termios
|
||||
# define termios sgttyb
|
||||
@@ -117,8 +115,6 @@ __unused static const char rcsid[] = "$Sudo$";
|
||||
# define tcsetattr(f, a, t) ioctl(f, a, t)
|
||||
# undef TCSAFLUSH
|
||||
# define TCSAFLUSH TIOCSETP
|
||||
# undef TCSANOW
|
||||
# define TCSANOW TIOCSETN
|
||||
# endif /* HAVE_TERMIO_H */
|
||||
#endif /* HAVE_TERMIOS_H */
|
||||
|
||||
@@ -202,7 +198,7 @@ restart:
|
||||
|
||||
/* Restore old tty settings and signals. */
|
||||
if (memcmp(&term, &oterm, sizeof(term)) != 0) {
|
||||
while (tcsetattr(input, TCSANOW|TCSASOFT, &oterm) == -1 &&
|
||||
while (tcsetattr(input, TCSAFLUSH|TCSASOFT, &oterm) == -1 &&
|
||||
errno == EINTR)
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user