From: Andreas Henriksson <andreas@fatal.se>
To: util-linux@vger.kernel.org
Cc: Andreas Henriksson <andreas@fatal.se>
Subject: [PATCH] sulogin: bail out from getpasswd(...) on timeout
Date: Mon, 28 Nov 2016 17:24:50 +0100 [thread overview]
Message-ID: <1480350290-7875-2-git-send-email-andreas@fatal.se> (raw)
In-Reply-To: <1480350290-7875-1-git-send-email-andreas@fatal.se>
If timeout happens while waiting in prompt, bail out instead
of retrying.
Reported-by: Bjørn Mork <bjorn@mork.no>
Addresses: http://bugs.debian.org/846107
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
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
next prev parent reply other threads:[~2016-11-28 16:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-28 16:24 [PATCH] sulogin: make getpasswd(...) return NULL on ^D Andreas Henriksson
2016-11-28 16:24 ` Andreas Henriksson [this message]
2016-12-07 12:34 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480350290-7875-2-git-send-email-andreas@fatal.se \
--to=andreas@fatal.se \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox