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().
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user