[systemd-devel] [systemd-commits] 2 commits - man/standard-conf.xml src/vconsole

Lennart Poettering lennart at poettering.net
Thu Apr 9 04:13:23 PDT 2015


On Sun, 15.03.15 17:42, Zbigniew Jędrzejewski-Szmek (zbyszek at kemper.freedesktop.org) wrote:

> diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
> index bf681d9..fe8573f 100644
> --- a/src/vconsole/vconsole-setup.c
> +++ b/src/vconsole/vconsole-setup.c
> @@ -96,16 +96,14 @@ static int enable_utf8(int fd) {
>          return r;
>  }
>  
> -static int keymap_load(const char *vc, const char *map, const char *map_toggle, bool utf8, pid_t *_pid) {
> +static bool keyboard_load_and_wait(const char *vc, const char *map,
> const char *map_toggle, bool utf8) {

No! Please don't!

We follow kernel-style error handling, and that means returning "int"
as return value, and negative errno values for errors.

Please do not turn error cases into "bool". This is simply confusing,
and different from all our other code.

If you want to return some boolean value, you then you can also do
that with an "int": return negative on error, 0 on false and 1 on
true...

Also see CODING_STYLE about this.

Will undo the part now that changes the return values of the functions
to bool.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list