dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

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

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