On 18/01/17 01:53, Peter Hutterer wrote:
> clients/editor.c: In function ‘read_file’:
> clients/editor.c:1578:16: warning: logical ‘or’ applied to non-boolean
> constant [-Wlogical-op]
>   errno = errsv || EINVAL;
> 
> This works in the shell, but not in C. Introduced in 411ffabbb56b
> 
> Signed-off-by: Peter Hutterer <[email protected]>
> ---
>  clients/editor.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/clients/editor.c b/clients/editor.c
> index f1dffe1..135dd9f 100644
> --- a/clients/editor.c
> +++ b/clients/editor.c
> @@ -1575,7 +1575,8 @@ error:
>       if (fin)
>               fclose(fin);
>       free(buffer);
> -     errno = errsv || EINVAL;
> +     if (errsv == 0)
> +             errno = EINVAL;

Shouldn't you add

        else
                errno = errsv;

?

Otherwise you may not return the original errno, but errno==0 instead (e.g. if
fclose() succeeded), which would be wrong.

Cheers,
Emilio

>  
>       return NULL;
>  }
> 

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to