summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-03-20 12:48:24 +1000
committerAnthony G. Basile <blueness@gentoo.org>2015-04-12 12:25:16 -0400
commitaccc92a8ad48f6f941caa5d3281064d7e67a3115 (patch)
treebde3407854f313b59c172fb52729c8414a4a02fc /src
parent206d05759f96c8fbed76982612db3d17371bbdca (diff)
udev: builtin-keyboard: move fetching the device node up
No point parsing the properties if we can't get the devnode to apply them later. Plus, this makes future additions easier to slot in. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/udev/udev-builtin-keyboard.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
index d8ee4cbb61..bde7bf07fb 100644
--- a/src/udev/udev-builtin-keyboard.c
+++ b/src/udev/udev-builtin-keyboard.c
@@ -75,6 +75,13 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
unsigned map_count = 0;
unsigned release[1024];
unsigned release_count = 0;
+ const char *node;
+
+ node = udev_device_get_devnode(dev);
+ if (!node) {
+ log_error("Error, no device node for '%s'", udev_device_get_syspath(dev));
+ return EXIT_FAILURE;
+ }
udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) {
const char *key;
@@ -128,17 +135,10 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
}
if (map_count > 0 || release_count > 0) {
- const char *node;
int fd;
unsigned i;
- node = udev_device_get_devnode(dev);
- if (!node) {
- log_error("Error, no device node for '%s'", udev_device_get_syspath(dev));
- return EXIT_FAILURE;
- }
-
- fd = open(udev_device_get_devnode(dev), O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
+ fd = open(node, O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
if (fd < 0) {
log_error_errno(errno, "Error, opening device '%s': %m", node);
return EXIT_FAILURE;