chiark / gitweb /
vconsole-setup: check error of child process
authorLucas De Marchi <lucas.demarchi@intel.com>
Fri, 13 Mar 2015 17:47:28 +0000 (17:47 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 16 Mar 2015 00:42:42 +0000 (20:42 -0400)
commit8931278c8a9ef7b60f6b6963486a9e9febb20a0d
tree3f4cf22a348cd66775c1ea89ed463928b5b7fb90
parent301f4073fe1c2757e602aef24cee9ccf5f81a3a3
vconsole-setup: check error of child process

If we don't check the error of the child process, systemd-vconsole-setup
would exit with 0 even if it could not really setup the console.

For a simple test, move loadkeys elsewhere and execute
systemd-vconsole-setup:

[root@localhost ~]# strace -f -e execve /usr/lib/systemd/systemd-vconsole-setup
execve("/usr/lib/systemd/systemd-vconsole-setup", ["/usr/lib/systemd/systemd-vconsol"...], [/* 15 vars */]) = 0
Process 171 attached
[pid   171] execve("/usr/bin/loadkeys", ["/usr/bin/loadkeys", "-q", "-C", "/dev/tty0", "br-abnt2"], [/* 15 vars */]) = -1 ENOENT (No such file or directory)
[pid   171] +++ exited with 1 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=171, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
+++ exited with 0 +++

Note that loadkeys returned 1 while systemd-vconsole-setup return 0.

Since the font and keyboard setup are already serialized, refactor the
code a little bit so the functions do the wait by themselves. One change
in behavior in this patch is that we don't return early, but we do try
to setup the keyboard even if the font load failed.
src/vconsole/vconsole-setup.c