[git commit] libbb: fix bb_ask() to flush input before prompt, not after. Closes 7190

Denys Vlasenko vda.linux at googlemail.com
Tue Jul 1 11:20:22 UTC 2014


commit: http://git.busybox.net/busybox/commit/?id=d32fc647d7da1923a91750ae937bf9b517195c8f
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/bb_askpass.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c
index 77c1bcd..1927ba9 100644
--- a/libbb/bb_askpass.c
+++ b/libbb/bb_askpass.c
@@ -30,9 +30,12 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt)
 	struct sigaction sa, oldsa;
 	struct termios tio, oldtio;
 
+	tcflush(fd, TCIFLUSH);
+	/* Was buggy: was printing prompt *before* flushing input,
+	 * which was upsetting "expect" based scripts of some users.
+	 */
 	fputs(prompt, stdout);
 	fflush_all();
-	tcflush(fd, TCIFLUSH);
 
 	tcgetattr(fd, &oldtio);
 	tio = oldtio;


More information about the busybox-cvs mailing list