From a17c5f22632b74aa17b1e395c0b175d7c1f52ab9 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 24 May 2014 12:48:32 -0500 Subject: patch from ashwini sharma: treat 0 length read at the start of password read as EOF. --- lib/password.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3