chiark / gitweb /
rules: mount fuse filesystem only 'add'
[elogind.git] / extras / keymap / keymap.c
index ed6b69d5f141d4b59c9bae21d473b1feb3864fca..597a53b467c20094b0233fb4d234f2ec38d438d2 100644 (file)
@@ -141,8 +141,9 @@ static int dump_table(int fd) {
                int keycode;
 
                if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) {
-                       if (keycode != -2)
-                               r = -1;
+                       if (keycode == -2)
+                               continue;
+                       r = -1;
                        break;
                }
 
@@ -191,8 +192,7 @@ static int merge_table(int fd, const char *filename) {
        f = fopen(filename, "r");
        if (!f) {
                perror(filename);
-               r = -1;
-               goto fail;
+               return -1;
        }
 
        while (!feof(f)) {
@@ -242,6 +242,7 @@ static int merge_table(int fd, const char *filename) {
                                scancode, new_keycode, old_keycode);
        }
 fail:
+       fclose(f);
        return r;
 }
 
@@ -311,7 +312,7 @@ static void interactive(int fd)
 
        /* grab input device */
        ioctl(fd, EVIOCGRAB, 1);
-       puts("Press ESC to finish");
+       puts("Press ESC to finish, or Control-C if this device is not your primary keyboard");
 
        has_scan = has_key = 0;
        while (read_event(fd, &ev)) {