]> 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>
Wed, 7 Dec 2016 12:32:42 +0000 (13:32 +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 806a967f0535039c255f4be5d2c5048231b91d8c..8dc2b639d3181e733c60f255838f533319393858 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;
                        }