naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
923a60
From a347fcea7ab1648cfa28b4fbb903ae95b879b86e Mon Sep 17 00:00:00 2001
923a60
From: Peter Hutterer <peter.hutterer@who-t.net>
923a60
Date: Fri, 20 Mar 2015 14:00:31 +1000
923a60
Subject: [PATCH] udev: builtin-keyboard: invert a condition
923a60
923a60
No functional changes, just to make the next patch easier to review
923a60
923a60
(cherry picked from commit 8a0fd83cf03547653a195582ba004d2ff69dfbd0)
923a60
923a60
Resolves: #1500119
923a60
---
923a60
 src/udev/udev-builtin-keyboard.c | 56 ++++++++++++++++----------------
923a60
 1 file changed, 28 insertions(+), 28 deletions(-)
923a60
923a60
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
923a60
index f33401790c..86f4018ef5 100644
923a60
--- a/src/udev/udev-builtin-keyboard.c
923a60
+++ b/src/udev/udev-builtin-keyboard.c
923a60
@@ -115,43 +115,43 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
923a60
         udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) {
923a60
                 const char *key;
923a60
                 char *endptr;
923a60
-                unsigned scancode;
923a60
-                const char *keycode;
923a60
 
923a60
                 key = udev_list_entry_get_name(entry);
923a60
-                if (!startswith(key, "KEYBOARD_KEY_"))
923a60
-                        continue;
923a60
-
923a60
-                /* KEYBOARD_KEY_<hex scan code>=<key identifier string> */
923a60
-                scancode = strtoul(key + 13, &endptr, 16);
923a60
-                if (endptr[0] != '\0') {
923a60
-                        log_error("Error, unable to parse scan code from '%s'", key);
923a60
-                        continue;
923a60
-                }
923a60
+                if (startswith(key, "KEYBOARD_KEY_")) {
923a60
+                        const char *keycode;
923a60
+                        unsigned scancode;
923a60
+
923a60
+                        /* KEYBOARD_KEY_<hex scan code>=<key identifier string> */
923a60
+                        scancode = strtoul(key + 13, &endptr, 16);
923a60
+                        if (endptr[0] != '\0') {
923a60
+                                log_error("Error, unable to parse scan code from '%s'", key);
923a60
+                                continue;
923a60
+                        }
923a60
 
923a60
-                keycode = udev_list_entry_get_value(entry);
923a60
+                        keycode = udev_list_entry_get_value(entry);
923a60
 
923a60
-                /* a leading '!' needs a force-release entry */
923a60
-                if (keycode[0] == '!') {
923a60
-                        keycode++;
923a60
+                        /* a leading '!' needs a force-release entry */
923a60
+                        if (keycode[0] == '!') {
923a60
+                                keycode++;
923a60
 
923a60
-                        release[release_count] = scancode;
923a60
-                        if (release_count <  ELEMENTSOF(release)-1)
923a60
-                                release_count++;
923a60
+                                release[release_count] = scancode;
923a60
+                                if (release_count <  ELEMENTSOF(release)-1)
923a60
+                                        release_count++;
923a60
 
923a60
-                        if (keycode[0] == '\0')
923a60
-                                continue;
923a60
-                }
923a60
+                                if (keycode[0] == '\0')
923a60
+                                        continue;
923a60
+                        }
923a60
 
923a60
-                if (fd == -1) {
923a60
-                        fd = open(node, O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
923a60
-                        if (fd < 0) {
923a60
-                                log_error_errno(errno, "Error, opening device '%s': %m", node);
923a60
-                                return EXIT_FAILURE;
923a60
+                        if (fd == -1) {
923a60
+                                fd = open(node, O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
923a60
+                                if (fd < 0) {
923a60
+                                        log_error_errno(errno, "Error, opening device '%s': %m", node);
923a60
+                                        return EXIT_FAILURE;
923a60
+                                }
923a60
                         }
923a60
-                }
923a60
 
923a60
-                map_keycode(fd, node, scancode, keycode);
923a60
+                        map_keycode(fd, node, scancode, keycode);
923a60
+                }
923a60
         }
923a60
 
923a60
         /* install list of force-release codes */