From a6016d333fa34e685e56ca16d48d2294f294fd12 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Wed, 9 Jul 2014 14:53:19 +0200 Subject: [PATCH] Make sure that keyb_fd is initially set to invalid value --- keyblogger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyblogger.c b/keyblogger.c index abc6350..af5be06 100644 --- a/keyblogger.c +++ b/keyblogger.c @@ -7,7 +7,7 @@ #define EV_RELEASED 0 #define EV_PRESSED 1 -static int keybd_fd = 0; +static int keybd_fd = -1; /** Accesses the keyboard to read raw keyboard events */ int init_keyb_logging(const char* evdev_path) @@ -28,7 +28,7 @@ void* get_keyb_events(void* args) exit_thrdata* etd = (exit_thrdata*)args; struct input_event ev; int run_loop = 1; - + while (run_loop) { read(keybd_fd, &ev, sizeof(struct input_event)); if (ev.type == EV_KEY) { -- 2.43.5