[PATCH libevdev 2/9] Return EBADF when trying to read from an uninitalized device

Peter Hutterer peter.hutterer at who-t.net
Tue Sep 3 00:07:40 PDT 2013


All other functions that check the fd for validity return EBADF, which also makes it
easier to debug if the actual device goes away.

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

diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 436f7a9..1c99e1f 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -663,7 +663,7 @@ libevdev_next_event(struct libevdev *dev, unsigned int flags, struct input_event
 	int rc = 0;
 
 	if (dev->fd < 0)
-		return -ENODEV;
+		return -EBADF;
 
 	if (!(flags & (LIBEVDEV_READ_NORMAL|LIBEVDEV_READ_SYNC|LIBEVDEV_FORCE_SYNC)))
 		return -EINVAL;
-- 
1.8.2.1



More information about the Input-tools mailing list