aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-05-24 12:48:32 -0500
committerRob Landley <rob@landley.net>2014-05-24 12:48:32 -0500
commita17c5f22632b74aa17b1e395c0b175d7c1f52ab9 (patch)
tree270ca1805547d97cf8f1c04da8ecd615256d1a32
parent984f90c07025168bf2b42ec37f027005229daa02 (diff)
downloadtoybox-a17c5f22632b74aa17b1e395c0b175d7c1f52ab9.tar.gz
patch from ashwini sharma: treat 0 length read at the start of password read as EOF.
-rw-r--r--lib/password.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/password.c b/lib/password.c
index 13a431ac..930e9c36 100644
--- a/lib/password.c
+++ b/lib/password.c
@@ -79,7 +79,7 @@ int read_password(char * buff, int buflen, char* mesg)
while (1) {
int ret = read(0, &buff[i], 1);
- if ( ret < 0 ) {
+ if ( ret < 0 || (!ret && !i)) {
buff[0] = 0;
sigaction(SIGINT, &oldsa, NULL);
tcsetattr(0, TCSANOW, &oldtermio);