From: Michal MalĂ˝ Date: Wed, 9 Jul 2014 12:53:19 +0000 (+0200) Subject: Make sure that keyb_fd is initially set to invalid value X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=LFSBench.git Make sure that keyb_fd is initially set to invalid value --- 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) {