summaryrefslogtreecommitdiff
path: root/udev/udevadm-test-builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'udev/udevadm-test-builtin.c')
-rw-r--r--udev/udevadm-test-builtin.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/udev/udevadm-test-builtin.c b/udev/udevadm-test-builtin.c
index 18f04bf888..ea1bcbcb07 100644
--- a/udev/udevadm-test-builtin.c
+++ b/udev/udevadm-test-builtin.c
@@ -70,6 +70,7 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[])
goto out;
}
}
+
command = argv[optind++];
if (command == NULL) {
fprintf(stderr, "command missing\n");
@@ -85,6 +86,16 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[])
goto out;
}
+ udev_builtin_load(udev);
+
+ cmd = udev_builtin_lookup(command);
+ if (cmd >= UDEV_BUILTIN_MAX) {
+ fprintf(stderr, "unknown command '%s'\n", command);
+ help(udev);
+ rc = 5;
+ goto out;
+ }
+
/* add /sys if needed */
if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0)
util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL);
@@ -99,16 +110,6 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[])
goto out;
}
- udev_builtin_load(udev);
-
- cmd = udev_builtin_lookup(command);
- if (cmd >= UDEV_BUILTIN_MAX) {
- fprintf(stderr, "unknown command '%s'\n", command);
- help(udev);
- rc = 5;
- goto out;
- }
-
if (udev_builtin_run(dev, cmd, command, true) < 0) {
fprintf(stderr, "error executing '%s'\n\n", command);
rc = 6;