From a12b87f59c8601aceaf58a8e1c3464aae329700a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 9 Mar 2019 10:20:42 +0900 Subject: 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(). --- src/udev/udevadm-test.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/udev/udevadm-test.c') 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) -- cgit v1.2.3