From 64eece071583f52b0eca8285848ab2746c14a769 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Wed, 3 Oct 2018 18:45:56 -0400 Subject: [PATCH] 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 --- src/util/ss/listen.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- 2.47.2