[PATCH] sulogin: bail out from getpasswd(...) on timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If timeout happens while waiting in prompt, bail out instead
of retrying.

Reported-by: Bjørn Mork <bjorn@xxxxxxx>
Addresses: http://bugs.debian.org/846107
Signed-off-by: Andreas Henriksson <andreas@xxxxxxxx>
---
 login-utils/sulogin.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index 43117b2..79a9274 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -645,6 +645,10 @@ static char *getpasswd(struct console *con)
 	while (cp->eol == '\0') {
 		if (read(fd, &c, 1) < 1) {
 			if (errno == EINTR || errno == EAGAIN) {
+				if (alarm_rised) {
+					ret = NULL;
+					goto quit;
+				}
 				xusleep(250000);
 				continue;
 			}
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux