summaryrefslogtreecommitdiffstats
path: root/src/basic/terminal-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-07-19 09:17:29 +0200
committerLennart Poettering <lennart@poettering.net>2024-07-19 11:44:04 +0200
commitaf1d3a6d928cb6f6be342d35ee5672c2a31e9d6c (patch)
treebce3a913524560d95b405db546130e0d7c4d5a2c /src/basic/terminal-util.c
parentterminal-util: don't export vt_reset_keyboard() + vt_default_utf8() (diff)
downloadsystemd-af1d3a6d928cb6f6be342d35ee5672c2a31e9d6c.tar.xz
systemd-af1d3a6d928cb6f6be342d35ee5672c2a31e9d6c.zip
terminal-util: modernize vt_reset_keyboard() a bit
Diffstat (limited to '')
-rw-r--r--src/basic/terminal-util.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index 60dcdb9712..c1f463a39b 100644
--- a/src/basic/terminal-util.c
+++ b/src/basic/terminal-util.c
@@ -512,11 +512,16 @@ static int vt_default_utf8(void) {
}
static int vt_reset_keyboard(int fd) {
- int kb;
+ int r, kb;
- /* If we can't read the default, then default to unicode. It's 2017 after all. */
- kb = vt_default_utf8() != 0 ? K_UNICODE : K_XLATE;
+ assert(fd >= 0);
+ /* If we can't read the default, then default to Unicode. It's 2024 after all. */
+ r = vt_default_utf8();
+ if (r < 0)
+ log_debug_errno(r, "Failed to determine kernel VT UTF-8 mode, assuming enabled: %m");
+
+ kb = vt_default_utf8() != 0 ? K_UNICODE : K_XLATE;
return RET_NERRNO(ioctl(fd, KDSKBMODE, kb));
}