]> Devoid-pointer.net GitWeb - LFSBench.git/commitdiff
Make sure that keyb_fd is initially set to invalid value master
authorMichal Malý <madcatxster@devoid-pointer.net>
Wed, 9 Jul 2014 12:53:19 +0000 (14:53 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Wed, 9 Jul 2014 12:53:19 +0000 (14:53 +0200)
keyblogger.c

index abc63500ac9c4ec2d7672282109b47004ab04a9f..af5be064941efeb1e38cad3c403cb90aef79805b 100644 (file)
@@ -7,7 +7,7 @@
 #define EV_RELEASED 0
 #define EV_PRESSED 1
 
 #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)
 
 /** 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;
   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) {
   while (run_loop) {
     read(keybd_fd, &ev, sizeof(struct input_event));
     if (ev.type == EV_KEY) {