]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sulogin: bail out from getpasswd(...) on timeout
authorAndreas Henriksson <andreas@fatal.se>
Mon, 28 Nov 2016 16:24:50 +0000 (17:24 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 17 Jan 2017 14:47:24 +0000 (15:47 +0100)
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

index 43117b2b46b8dd2145c98a83e5b2d50207c710fb..79a9274222f6155521a8549b53812737b900656e 100644 (file)
@@ -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;
                        }