cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0167-sulogin-bail-out-from-getpasswd-.-on-timeout.patch

05ad79
From 971b2ecede4d2040e879d9cfb56332a2e210bed8 Mon Sep 17 00:00:00 2001
05ad79
From: Andreas Henriksson <andreas@fatal.se>
05ad79
Date: Mon, 28 Nov 2016 17:24:50 +0100
05ad79
Subject: [PATCH 167/173] sulogin: bail out from getpasswd(...) on timeout
05ad79
MIME-Version: 1.0
05ad79
Content-Type: text/plain; charset=UTF-8
05ad79
Content-Transfer-Encoding: 8bit
05ad79
05ad79
If timeout happens while waiting in prompt, bail out instead
05ad79
of retrying.
05ad79
05ad79
Reported-by: Bjørn Mork <bjorn@mork.no>
05ad79
Addresses: http://bugs.debian.org/846107
05ad79
Upstream: http://github.com/karelzak/util-linux/commit/1c4b2d43926e2a7032310cd18b411d8d872cb4ed
05ad79
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1561200
05ad79
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
05ad79
---
05ad79
 login-utils/sulogin.c | 4 ++++
05ad79
 1 file changed, 4 insertions(+)
05ad79
05ad79
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
05ad79
index 7ec349953..dd73a1c50 100644
05ad79
--- a/login-utils/sulogin.c
05ad79
+++ b/login-utils/sulogin.c
05ad79
@@ -611,6 +611,10 @@ static char *getpasswd(struct console *con)
05ad79
 	while (cp->eol == '\0') {
05ad79
 		if (read(fd, &c, 1) < 1) {
05ad79
 			if (errno == EINTR || errno == EAGAIN) {
05ad79
+				if (alarm_rised) {
05ad79
+					ret = NULL;
05ad79
+					goto quit;
05ad79
+				}
05ad79
 				usleep(1000);
05ad79
 				continue;
05ad79
 			}
05ad79
-- 
05ad79
2.14.4
05ad79