]> rtime.felk.cvut.cz Git - coffee/mt-apps.git/commitdiff
Check open() errors correctly
authorMichal Sojka <michal.sojka@cvut.cz>
Mon, 6 Aug 2018 11:48:46 +0000 (13:48 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Mon, 6 Aug 2018 11:48:46 +0000 (13:48 +0200)
mt_keys.c

index 9b1dcadf03beb8651cd74fb5c3c6ec38f91793f0..a2093405866ff56d4ee80737a659d637dc31e451 100644 (file)
--- a/mt_keys.c
+++ b/mt_keys.c
@@ -101,7 +101,7 @@ static void keys_cb(EV_P_ ev_io *w_, int revents)
 int mt_keys_init(mt_keys_t *self, struct ev_loop *loop, int fd)
 {
     int ev = open("/dev/input/by-path/platform-gpio-keys-event", O_RDONLY);
-    if (fd == -1) {
+    if (ev == -1) {
         perror("/dev/input/by-path/platform-gpio-keys-event");
         return -1;
     }