diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-07-01 13:20:22 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-07-01 13:20:22 +0200 |
commit | d32fc647d7da1923a91750ae937bf9b517195c8f (patch) | |
tree | 30a465ac163710cca1814c3114e7b00f011ae327 /libbb | |
parent | 184b2669175e562d58894e22f6320cebf3316c25 (diff) | |
download | busybox-w32-d32fc647d7da1923a91750ae937bf9b517195c8f.tar.gz busybox-w32-d32fc647d7da1923a91750ae937bf9b517195c8f.tar.bz2 busybox-w32-d32fc647d7da1923a91750ae937bf9b517195c8f.zip |
libbb: fix bb_ask() to flush input before prompt, not after. Closes 7190
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | 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 77c1bcd95..1927ba9e9 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) | |||
30 | struct sigaction sa, oldsa; | 30 | struct sigaction sa, oldsa; |
31 | struct termios tio, oldtio; | 31 | struct termios tio, oldtio; |
32 | 32 | ||
33 | tcflush(fd, TCIFLUSH); | ||
34 | /* Was buggy: was printing prompt *before* flushing input, | ||
35 | * which was upsetting "expect" based scripts of some users. | ||
36 | */ | ||
33 | fputs(prompt, stdout); | 37 | fputs(prompt, stdout); |
34 | fflush_all(); | 38 | fflush_all(); |
35 | tcflush(fd, TCIFLUSH); | ||
36 | 39 | ||
37 | tcgetattr(fd, &oldtio); | 40 | tcgetattr(fd, &oldtio); |
38 | tio = oldtio; | 41 | tio = oldtio; |