teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0553-udev-builtin-keyboard-move-fetching-the-device-node-.patch

dd65c9
From 7d6891da40f2f5cfbc5bf02b6a58dc49c1577373 Mon Sep 17 00:00:00 2001
dd65c9
From: Peter Hutterer <peter.hutterer@who-t.net>
dd65c9
Date: Fri, 20 Mar 2015 12:48:24 +1000
dd65c9
Subject: [PATCH] udev: builtin-keyboard: move fetching the device node up
dd65c9
dd65c9
No point parsing the properties if we can't get the devnode to apply them
dd65c9
later. Plus, this makes future additions easier to slot in.
dd65c9
dd65c9
(cherry picked from commit 753bd5c7ede5e74c21221fcf59de3ce320d6722d)
dd65c9
dd65c9
Resolves: #1500119
dd65c9
---
dd65c9
 src/udev/udev-builtin-keyboard.c | 16 ++++++++--------
dd65c9
 1 file changed, 8 insertions(+), 8 deletions(-)
dd65c9
dd65c9
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
c62b8e
index d8ee4cbb61..bde7bf07fb 100644
dd65c9
--- a/src/udev/udev-builtin-keyboard.c
dd65c9
+++ b/src/udev/udev-builtin-keyboard.c
dd65c9
@@ -75,6 +75,13 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
dd65c9
         unsigned map_count = 0;
dd65c9
         unsigned release[1024];
dd65c9
         unsigned release_count = 0;
dd65c9
+        const char *node;
dd65c9
+
dd65c9
+        node = udev_device_get_devnode(dev);
dd65c9
+        if (!node) {
dd65c9
+                log_error("Error, no device node for '%s'", udev_device_get_syspath(dev));
dd65c9
+                return EXIT_FAILURE;
dd65c9
+        }
dd65c9
 
dd65c9
         udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) {
dd65c9
                 const char *key;
dd65c9
@@ -128,17 +135,10 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
dd65c9
         }
dd65c9
 
dd65c9
         if (map_count > 0 || release_count > 0) {
dd65c9
-                const char *node;
dd65c9
                 int fd;
dd65c9
                 unsigned i;
dd65c9
 
dd65c9
-                node = udev_device_get_devnode(dev);
dd65c9
-                if (!node) {
dd65c9
-                        log_error("Error, no device node for '%s'", udev_device_get_syspath(dev));
dd65c9
-                        return EXIT_FAILURE;
dd65c9
-                }
dd65c9
-
dd65c9
-                fd = open(udev_device_get_devnode(dev), O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
dd65c9
+                fd = open(node, O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
dd65c9
                 if (fd < 0) {
dd65c9
                         log_error_errno(errno, "Error, opening device '%s': %m", node);
dd65c9
                         return EXIT_FAILURE;