60 lines
1.5 KiB
Diff
60 lines
1.5 KiB
Diff
|
|
From 8efec058d7a513c18f5e5666e79006ded786221a Mon Sep 17 00:00:00 2001
|
||
|
|
From: Karel Zak <kzak@redhat.com>
|
||
|
|
Date: Tue, 2 May 2023 11:36:49 +0200
|
||
|
|
Subject: [PATCH] sulogin: fix KDGKBMODE ifdef
|
||
|
|
|
||
|
|
* remove ifdef-else for KDGKBMODE
|
||
|
|
|
||
|
|
* always call KDGKBMODE for virtual console to get K_UNICODE status
|
||
|
|
|
||
|
|
* use KDGKBMODE as a fallback to detect serial line
|
||
|
|
|
||
|
|
Fixes: https://github.com/util-linux/util-linux/issues/2185
|
||
|
|
Suggested-by: Marcos Mello
|
||
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||
|
|
---
|
||
|
|
login-utils/sulogin.c | 14 +++++++-------
|
||
|
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
|
||
|
|
index 851d92d..3507272 100644
|
||
|
|
--- a/login-utils/sulogin.c
|
||
|
|
+++ b/login-utils/sulogin.c
|
||
|
|
@@ -108,7 +108,7 @@ static void tcinit(struct console *con)
|
||
|
|
struct termios *tio = &con->tio;
|
||
|
|
const int fd = con->fd;
|
||
|
|
#if defined(TIOCGSERIAL)
|
||
|
|
- struct serial_struct serinfo;
|
||
|
|
+ struct serial_struct serinfo = { .flags = 0 };
|
||
|
|
#endif
|
||
|
|
#ifdef USE_PLYMOUTH_SUPPORT
|
||
|
|
struct termios lock;
|
||
|
|
@@ -132,18 +132,18 @@ static void tcinit(struct console *con)
|
||
|
|
errno = 0;
|
||
|
|
#endif
|
||
|
|
|
||
|
|
-#if defined(TIOCGSERIAL)
|
||
|
|
+#ifdef TIOCGSERIAL
|
||
|
|
if (ioctl(fd, TIOCGSERIAL, &serinfo) >= 0)
|
||
|
|
con->flags |= CON_SERIAL;
|
||
|
|
errno = 0;
|
||
|
|
-#else
|
||
|
|
-# if defined(KDGKBMODE)
|
||
|
|
- if (ioctl(fd, KDGKBMODE, &mode) < 0)
|
||
|
|
+#endif
|
||
|
|
+
|
||
|
|
+#ifdef KDGKBMODE
|
||
|
|
+ if (!(con->flags & CON_SERIAL)
|
||
|
|
+ && ioctl(fd, KDGKBMODE, &mode) < 0)
|
||
|
|
con->flags |= CON_SERIAL;
|
||
|
|
errno = 0;
|
||
|
|
-# endif
|
||
|
|
#endif
|
||
|
|
-
|
||
|
|
if (tcgetattr(fd, tio) < 0) {
|
||
|
|
int saveno = errno;
|
||
|
|
#if defined(KDGKBMODE) || defined(TIOCGSERIAL)
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|