[PATCH libevdev 3/4] test: shut up compiler warning

Peter Hutterer peter.hutterer at who-t.net
Mon Mar 17 21:21:01 PDT 2014


test-libevdev-events.c: In function ‘test_double_syn_dropped_event’:
test-libevdev-events.c:187:2: warning: ignoring return value of ‘read’,
declared with attribute warn_unused_result [-Wunused-result]

This read was there to drain events even when there shouldn't be any on the
pipe anyway. So let's add an assert.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/test-libevdev-events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test-libevdev-events.c b/test/test-libevdev-events.c
index 56f21a6..de598f9 100644
--- a/test/test-libevdev-events.c
+++ b/test/test-libevdev-events.c
@@ -184,7 +184,7 @@ START_TEST(test_double_syn_dropped_event)
 	/* sneak in a button change event while we're not looking, this way
 	 * the sync queue contains 2 events: BTN_LEFT and SYN_REPORT. */
 	uinput_device_event(uidev, EV_KEY, BTN_LEFT, 0);
-	read(pipefd[0], &ev, sizeof(ev));
+	ck_assert_int_eq(read(pipefd[0], &ev, sizeof(ev)), -1);
 
 	libevdev_change_fd(dev, uinput_device_get_fd(uidev));
 
-- 
1.8.5.3



More information about the Input-tools mailing list