terminal-util: modernize vt_reset_keyboard() a bit

This commit is contained in:
Lennart Poettering
2024-07-19 11:44:04 +02:00
parent b61c015aeb
commit af1d3a6d92
+8 -3
View File
@@ -512,11 +512,16 @@ static int vt_default_utf8(void) {
}
static int vt_reset_keyboard(int fd) {
int kb;
int r, kb;
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");
/* 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;
return RET_NERRNO(ioctl(fd, KDSKBMODE, kb));
}