3
0
forked from pool/util-linux
Dr. Werner Fink 2020-10-30 14:33:02 +00:00 committed by Git OBS Bridge
parent 9ae5124e0d
commit fd21f8d012
3 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,69 @@
From: Werner Fink <werner@suse.de>
Date: Fri, 30 Oct 2020 14:54:59 +0100
Subject: [PATCH] sulogin: ignore not existing console devices
and also not functional console devices. Redirect the error
messages to the appropiate console device.
---
sulogin.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index 9091caf14..7ee8f2dc7 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -608,7 +608,7 @@ static const char *getpasswd(struct console *con)
struct termios tty;
static char pass[128], *ptr;
struct chardata *cp;
- const char *ret = pass;
+ const char *ret = NULL;
unsigned char tc;
char c, ascval;
int eightbit;
@@ -618,6 +618,7 @@ static const char *getpasswd(struct console *con)
goto out;
cp = &con->cp;
tty = con->tio;
+ ret = pass;
tty.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY);
tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP|ISIG);
@@ -647,11 +648,12 @@ static const char *getpasswd(struct console *con)
}
ret = NULL;
switch (errno) {
- case 0:
case EIO:
+ con->flags |= CON_NOTTY;
case ESRCH:
case EINVAL:
case ENOENT:
+ case 0:
break;
default:
warn(_("cannot read %s"), con->tty);
@@ -968,10 +970,13 @@ int main(int argc, char **argv)
con = list_entry(ptr, struct console, entry);
if (con->id >= CONMAX)
break;
+ if (con->flags & CON_NOTTY)
+ goto next;
switch ((con->pid = fork())) {
case 0:
mask_signal(SIGCHLD, SIG_DFL, NULL);
+ dup2(con->fd, STDERR_FILENO);
nofork:
setup(con);
while (1) {
@@ -1026,7 +1031,7 @@ int main(int argc, char **argv)
default:
break;
}
-
+ next:
ptr = ptr->next;
} while (ptr != &consoles);

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Oct 30 14:03:47 UTC 2020 - Dr. Werner Fink <werner@suse.de>
- Add patch util-linux-sulogin4bsc1175514.patch
Avoid sulogin failing on not existing or not functional console
devices (bsc#1175514)
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Sep 16 00:10:11 UTC 2020 - Stanislav Brabec <sbrabec@suse.com> Wed Sep 16 00:10:11 UTC 2020 - Stanislav Brabec <sbrabec@suse.com>

View File

@ -127,6 +127,8 @@ Source51: blkid.conf
Patch0: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff Patch0: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
Patch1: libmount-print-a-blacklist-hint-for-unknown-filesyst.patch Patch1: libmount-print-a-blacklist-hint-for-unknown-filesyst.patch
Patch2: Add-documentation-on-blacklisted-modules-to-mount-8-.patch Patch2: Add-documentation-on-blacklisted-modules-to-mount-8-.patch
# PATCH-FIX-SUSE: Avoid sulogin failing on not existing or not functional console devices
Patch3: util-linux-sulogin4bsc1175514.patch
# #
%if %{with base} %if %{with base}
%if 0%{?suse_version} >= 1330 %if 0%{?suse_version} >= 1330