[PATCH libinput] timer: fix coverity warning about unused return value

Hans de Goede hdegoede at redhat.com
Fri May 15 03:58:11 PDT 2015


Hi,

On 06-05-15 02:01, Peter Hutterer wrote:
> "read(int, void *, size_t)" returns the number of bytes read, but it
> is ignored.
>
> We don't really care about the number of bytes, but let's complain if we get
> anything but EAGAIN.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

LGTM: Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans

> ---
>   src/timer.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/timer.c b/src/timer.c
> index 114a649..d1d3c10 100644
> --- a/src/timer.c
> +++ b/src/timer.c
> @@ -102,8 +102,14 @@ libinput_timer_handler(void *data)
>   	struct libinput_timer *timer, *tmp;
>   	uint64_t now;
>   	uint64_t discard;
> +	int r;
>
> -	read(libinput->timer.fd, &discard, sizeof(discard));
> +	r = read(libinput->timer.fd, &discard, sizeof(discard));
> +	if (r == -1 && errno != EAGAIN)
> +		log_bug_libinput(libinput,
> +				 "Error %d reading from timerfd (%s)",
> +				 errno,
> +				 strerror(errno));
>
>   	now = libinput_now(libinput);
>   	if (now == 0)
>


More information about the wayland-devel mailing list