1303 files changed, 32187 insertions, 57138 deletions
diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c index 77c1bcd..c2580b9 100644 --- a/libbb/bb_askpass.c +++ b/libbb/bb_askpass.c @@ -1,7 +1,6 @@ /* vi: set sw=4 ts=4: */ /* * Ask for a password - * I use a static buffer in this function. Plan accordingly. * * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> * @@ -23,16 +22,19 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt) { /* Was static char[BIGNUM] */ enum { sizeof_passwd = 128 }; - static char *passwd; + char *passwd; char *ret; int i; 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; @@ -59,8 +61,7 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt) alarm(timeout); } - if (!passwd) - passwd = xmalloc(sizeof_passwd); + passwd = auto_string(xmalloc(sizeof_passwd)); ret = passwd; i = 0; while (1) { |