[PATCH 2/4] config: fix boolean parsing

Kristian Høgsberg krh at bitplanet.net
Tue Nov 15 06:05:16 PST 2011


On Tue, Nov 15, 2011 at 4:45 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> The rest of the line contains the newline, so cannot match simply 'true'
> or 'false'.

Thank you, applied. I obviously didn't test that one.

Kristian

> Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
> ---
>  clients/config.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/clients/config.c b/clients/config.c
> index 42acee7..be7b5db 100644
> --- a/clients/config.c
> +++ b/clients/config.c
> @@ -54,9 +54,9 @@ handle_key(const struct config_key *key, const char *value)
>                return 0;
>
>        case CONFIG_KEY_BOOL:
> -               if (strcmp(value, "false") == 0)
> +               if (strcmp(value, "false\n") == 0)
>                        *(int *)key->data = 0;
> -               else if (strcmp(value, "true") == 0)
> +               else if (strcmp(value, "true\n") == 0)
>                        *(int *)key->data = 1;
>                else {
>                        fprintf(stderr, "invalid bool: %s\n", value);
> --
> 1.7.3.4
>
>


More information about the wayland-devel mailing list