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)
|
# define tcsetattr(f, a, t) ioctl(f, a, t)
|
||||||
# undef TCSAFLUSH
|
# undef TCSAFLUSH
|
||||||
# define TCSAFLUSH TCSETAF
|
# define TCSAFLUSH TCSETAF
|
||||||
# undef TCSANOW
|
|
||||||
# define TCSANOW TCSETA
|
|
||||||
# else
|
# else
|
||||||
# undef termios
|
# undef termios
|
||||||
# define termios sgttyb
|
# define termios sgttyb
|
||||||
@@ -117,8 +115,6 @@ __unused static const char rcsid[] = "$Sudo$";
|
|||||||
# define tcsetattr(f, a, t) ioctl(f, a, t)
|
# define tcsetattr(f, a, t) ioctl(f, a, t)
|
||||||
# undef TCSAFLUSH
|
# undef TCSAFLUSH
|
||||||
# define TCSAFLUSH TIOCSETP
|
# define TCSAFLUSH TIOCSETP
|
||||||
# undef TCSANOW
|
|
||||||
# define TCSANOW TIOCSETN
|
|
||||||
# endif /* HAVE_TERMIO_H */
|
# endif /* HAVE_TERMIO_H */
|
||||||
#endif /* HAVE_TERMIOS_H */
|
#endif /* HAVE_TERMIOS_H */
|
||||||
|
|
||||||
@@ -202,7 +198,7 @@ restart:
|
|||||||
|
|
||||||
/* Restore old tty settings and signals. */
|
/* Restore old tty settings and signals. */
|
||||||
if (memcmp(&term, &oterm, sizeof(term)) != 0) {
|
if (memcmp(&term, &oterm, sizeof(term)) != 0) {
|
||||||
while (tcsetattr(input, TCSANOW|TCSASOFT, &oterm) == -1 &&
|
while (tcsetattr(input, TCSAFLUSH|TCSASOFT, &oterm) == -1 &&
|
||||||
errno == EINTR)
|
errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user