summaryrefslogtreecommitdiffstats
path: root/src/vconsole/vconsole-setup.c
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2023-12-01 08:44:53 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2023-12-01 14:53:20 +0100
commit2f26c211718d29c322b2732d99617fce4d837ae1 (patch)
tree0f22640c4c38dc643fada3afaca78d9377abeb2c /src/vconsole/vconsole-setup.c
parentukify: avoid deprecated datetime call (diff)
downloadsystemd-2f26c211718d29c322b2732d99617fce4d837ae1.tar.xz
systemd-2f26c211718d29c322b2732d99617fce4d837ae1.zip
vconsole-setup: use a consistent log level when setfont fails with EX_OSERR
Since we accept that setfont(8) can fail with EX_OSERR and we dont treat it as an error, dont log this failure at LOG_ERR. Before: ------- /usr/bin/setfont failed with exit status 71. [LOG_ERR] Setting fonts failed with a "system error", ignoring. [LOG_NOTICE] After: ----- /usr/bin/setfont failed with a "system error" (EX_OSERR), ignoring. [LOG_NOTICE] Setting source virtual console failed, ignoring remaining ones [LOG_NOTICE] Follow-up for 93c9a9d235e2304500c490b4868534385f925c76
Diffstat (limited to 'src/vconsole/vconsole-setup.c')
-rw-r--r--src/vconsole/vconsole-setup.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 564f142284..4d82c65f0a 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -361,7 +361,16 @@ static int font_load_and_wait(const char *vc, Context *c) {
_exit(EXIT_FAILURE);
}
- return wait_for_terminate_and_check(KBD_SETFONT, pid, WAIT_LOG);
+ /* setfont returns EX_OSERR when ioctl(KDFONTOP/PIO_FONTX/PIO_FONTX) fails. This might mean various
+ * things, but in particular lack of a graphical console. Let's be generous and not treat this as an
+ * error. */
+ r = wait_for_terminate_and_check(KBD_SETFONT, pid, WAIT_LOG_ABNORMAL);
+ if (r == EX_OSERR)
+ log_notice(KBD_SETFONT " failed with a \"system error\" (EX_OSERR), ignoring.");
+ else if (r >= 0 && r != EXIT_SUCCESS)
+ log_error(KBD_SETFONT " failed with exit status %i.", r);
+
+ return r;
}
/*
@@ -615,13 +624,9 @@ static int run(int argc, char **argv) {
if (idx > 0) {
if (r == 0)
setup_remaining_vcs(fd, idx, utf8);
- else if (r == EX_OSERR)
- /* setfont returns EX_OSERR when ioctl(KDFONTOP/PIO_FONTX/PIO_FONTX) fails.
- * This might mean various things, but in particular lack of a graphical
- * console. Let's be generous and not treat this as an error. */
- log_notice("Setting fonts failed with a \"system error\", ignoring.");
else
- log_warning("Setting source virtual console failed, ignoring remaining ones");
+ log_full(r == EX_OSERR ? LOG_NOTICE : LOG_WARNING,
+ "Setting source virtual console failed, ignoring remaining ones.");
}
return IN_SET(r, 0, EX_OSERR) && keyboard_ok ? EXIT_SUCCESS : EXIT_FAILURE;