From: Michal Sojka Date: Mon, 6 Aug 2018 11:48:46 +0000 (+0200) Subject: Check open() errors correctly X-Git-Url: https://rtime.felk.cvut.cz/gitweb/coffee/mt-apps.git/commitdiff_plain/80284beca5b4390af06cea749e304b5b78cd0393?ds=sidebyside Check open() errors correctly --- diff --git a/mt_keys.c b/mt_keys.c index 9b1dcad..a209340 100644 --- 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; }