From ebcf3cf399a8578f446e7deccfe5bf0716b3a0cd Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 16 Jan 2008 18:03:08 +0000 Subject: [PATCH] Use TCSAFLUSH when restoring terminal settings (and echo) to guarantee that any pending output is discarded --- tgetpass.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tgetpass.c b/tgetpass.c index b266c4f26..bb7cf3c27 100644 --- a/tgetpass.c +++ b/tgetpass.c @@ -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; }