diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-09 02:20:42 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-11 19:49:53 +0100 |
commit | a12b87f59c8601aceaf58a8e1c3464aae329700a (patch) | |
tree | 1544483f9369159f75b0c184ea4bc8d234b78ad2 /src/udev | |
parent | udevadm: use device_get_action() (diff) | |
download | systemd-a12b87f59c8601aceaf58a8e1c3464aae329700a.tar.xz systemd-a12b87f59c8601aceaf58a8e1c3464aae329700a.zip |
udevadm-test: check action string earlier
The string will be checked later in device_new_from_synthetic_event(),
but let's check it earlier in parse_argv().
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udevadm-test.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c index 9c1784489a..da4c4cb87c 100644 --- a/src/udev/udevadm-test.c +++ b/src/udev/udevadm-test.c @@ -53,9 +53,17 @@ static int parse_argv(int argc, char *argv[]) { while ((c = getopt_long(argc, argv, "a:N:Vh", options, NULL)) >= 0) switch (c) { - case 'a': + case 'a': { + DeviceAction a; + + a = device_action_from_string(optarg); + if (a < 0) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Invalid action '%s'", optarg); + arg_action = optarg; break; + } case 'N': arg_resolve_name_timing = resolve_name_timing_from_string(optarg); if (arg_resolve_name_timing < 0) |