[systemd-devel] [PATCH] vconsole-setup: check error of child process

Lucas De Marchi lucas.de.marchi at gmail.com
Wed Mar 11 09:18:46 PDT 2015


On Wed, Mar 11, 2015 at 1:17 PM, David Herrmann <dh.herrmann at gmail.com> wrote:
>>>> diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
>>>> index bf681d9..601ca4a 100644
>>>> --- a/src/vconsole/vconsole-setup.c
>>>> +++ b/src/vconsole/vconsole-setup.c
>>>> @@ -304,8 +304,12 @@ int main(int argc, char **argv) {
>>>>                  return EXIT_FAILURE;
>>>>          }
>>>>
>>>> -        if (font_pid > 0)
>>>> -                wait_for_terminate_and_warn(KBD_SETFONT, font_pid, true);
>>>> +        if (font_pid > 0) {
>>>> +                r = wait_for_terminate_and_warn(KBD_SETFONT, font_pid, true);
>>>> +                if (r != 0)
>>>> +                        return EXIT_FAILURE;
>>>> +        }
>>>> +
>>>
>>> Looks mostly good. However, I'd prefer if we continue on "r > 0" but
>>> remember the error for later. This way, we still try loading the right
>>> keymap even though the font might have failed.
>>
>> Is there any reason to continue on r > 0 but not on r < 0? I'm ok with
>> changing the current behavior, but just like to know which one is
>> better.
>
> Yeah, not sure here. For most helpers here r<0 means serious error
> (fork() failed, etc.), r>0 means just the spawned application failed.
> I guess we should continue for all !=0. That is, don't return
> prematurely at all.

ok... I'll send a v2


-- 
Lucas De Marchi


More information about the systemd-devel mailing list