krb5 commit: Disable stdin buffering in libss dummy readline

Greg Hudson ghudson at mit.edu
Thu Oct 4 12:36:02 EDT 2018


https://github.com/krb5/krb5/commit/64eece071583f52b0eca8285848ab2746c14a769
commit 64eece071583f52b0eca8285848ab2746c14a769
Author: Greg Hudson <ghudson at mit.edu>
Date:   Wed Oct 3 18:45:56 2018 -0400

    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 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/util/ss/listen.c b/src/util/ss/listen.c
index c99caa3..879ebcf 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);


More information about the cvs-krb5 mailing list