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

Peter Hutterer peter.hutterer at who-t.net
Tue May 5 17:01:09 PDT 2015


"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>
---
 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)
-- 
2.3.5



More information about the wayland-devel mailing list