naccyde / rpms / systemd

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