From: Greg Hudson Date: Wed, 3 Oct 2018 22:45:56 +0000 (-0400) Subject: Disable stdin buffering in libss dummy readline X-Git-Tag: krb5-1.17-beta1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F854%2Fhead;p=thirdparty%2Fkrb5.git Disable stdin buffering in libss dummy readline readline() is careful not to read more bytes from fd 0 than it has to. Do the same in the dummy libss readline() by disabling stdin buffering. ticket: 8745 --- diff --git a/src/util/ss/listen.c b/src/util/ss/listen.c index c99caa34bd..879ebcfbd5 100644 --- a/src/util/ss/listen.c +++ b/src/util/ss/listen.c @@ -33,6 +33,9 @@ static char *readline(const char *prompt) struct termios termbuf; char input[BUFSIZ]; + /* Make sure we don't buffer anything beyond the line read. */ + setvbuf(stdin, 0, _IONBF, 0); + if (tcgetattr(STDIN_FILENO, &termbuf) == 0) { termbuf.c_lflag |= ICANON|ISIG|ECHO; tcsetattr(STDIN_FILENO, TCSANOW, &termbuf);