diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/bb_askpass.c | 6 | ||||
-rw-r--r-- | libbb/human_readable.c | 9 |
2 files changed, 3 insertions, 12 deletions
diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c index 1927ba9..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,8 +22,8 @@ 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; @@ -62,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) { diff --git a/libbb/human_readable.c b/libbb/human_readable.c index 0b2eb77..5c7fc07 100644 --- a/libbb/human_readable.c +++ b/libbb/human_readable.c @@ -37,8 +37,6 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val, '\0', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' }; - static char *str; - unsigned frac; /* 0..9 - the fractional digit */ const char *u; const char *fmt; @@ -81,12 +79,7 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val, #endif } - if (!str) { - /* sufficient for any width of val */ - str = xmalloc(sizeof(val)*3 + 2 + 3); - } - sprintf(str, fmt, val, frac, *u); - return str; + return auto_string(xasprintf(fmt, val, frac, *u)); } |