From: Karel Zak Date: Fri, 7 Jan 2022 12:49:40 +0000 (+0100) Subject: sulogin: fix compiler warning [-Werror=implicit-fallthrough=] X-Git-Tag: v2.38-rc1~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=789bffdd7070b11749913072ebdacae72154d140;p=thirdparty%2Futil-linux.git sulogin: fix compiler warning [-Werror=implicit-fallthrough=] and make sure errno is reset before read() Signed-off-by: Karel Zak --- diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c index 227826ffcf..4c2daa6a4a 100644 --- a/login-utils/sulogin.c +++ b/login-utils/sulogin.c @@ -698,7 +698,10 @@ static char *getpasswd(struct console *con) cp->eol = *ptr = '\0'; eightbit = ((con->flags & CON_SERIAL) == 0 || (tty.c_cflag & (PARODD|PARENB)) == 0); + while (cp->eol == '\0') { + errno = 0; + if (read(fd, &c, 1) < 1) { if (errno == EINTR || errno == EAGAIN) { if (alarm_rised) { @@ -709,9 +712,11 @@ static char *getpasswd(struct console *con) continue; } ret = NULL; + switch (errno) { case EIO: con->flags |= CON_EIO; + /* fallthrough */ default: warn(_("cannot read %s"), con->tty); break;