ssh: fflush the shell prompt
authorAlan Cox <alan@linux.intel.com>
Sun, 7 Dec 2014 14:29:24 +0000 (14:29 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 7 Dec 2014 14:29:24 +0000 (14:29 +0000)
From: Will Sowerbutts <will@sowerbutts.com>

The assumption that libc will fflush stdout on an fgets of stdin is not anything
the standards guarantee. Do the needed fflush

Applications/util/ssh.c

index 6399ac7..aad1008 100644 (file)
@@ -51,6 +51,7 @@ main(int argc, char *argval[])
         for (i = 0; i < MAX_ARGS; i++) arg[i][0] = (char) 0;
         do {
             printf("ssh%c ", cprompt);
+            fflush(stdout);
             fgets(buf, 127, stdin);
             if (feof(stdin)) return 0;     /* user typed ^D ? */
             buf[strlen(buf) - 1] = '\0';   /* Strip newline from fgets */