aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/bb_askpass.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c
index fe2b50677..77c1bcd95 100644
--- a/libbb/bb_askpass.c
+++ b/libbb/bb_askpass.c
@@ -65,7 +65,9 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt)
i = 0;
while (1) {
int r = read(fd, &ret[i], 1);
- if (r < 0) {
+ if ((i == 0 && r == 0) /* EOF (^D) with no password */
+ || r < 0
+ ) {
/* read is interrupted by timeout or ^C */
ret = NULL;
break;