sulogin: bail out from getpasswd(...) on timeout

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>
This commit is contained in:
Andreas Henriksson 2016-11-28 17:24:50 +01:00 committed by Karel Zak
parent 60dea9d187
commit 1c4b2d4392
1 changed files with 4 additions and 0 deletions

View 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;
}