libbb: fix bb_ask() to flush input before prompt, not after. Closes 7190
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
184b266917
commit
d32fc647d7
@ -30,9 +30,12 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt)
|
|||||||
struct sigaction sa, oldsa;
|
struct sigaction sa, oldsa;
|
||||||
struct termios tio, oldtio;
|
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);
|
fputs(prompt, stdout);
|
||||||
fflush_all();
|
fflush_all();
|
||||||
tcflush(fd, TCIFLUSH);
|
|
||||||
|
|
||||||
tcgetattr(fd, &oldtio);
|
tcgetattr(fd, &oldtio);
|
||||||
tio = oldtio;
|
tio = oldtio;
|
||||||
|
Loading…
Reference in New Issue
Block a user