udevadm-settle: reject positional arguments

The settle command does not define positional arguments.

Reject them during argument parsing instead of silently ignoring
them.

Reproducer:
  udevadm settle /no/such/argument

Before:
  The command exits successfully and ignores the argument.

Follow-up:
  c71509028f
This commit is contained in:
dongshengyuan
2026-07-13 12:18:49 +08:00
parent 7bd6b8c587
commit 778f932032
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -88,6 +88,10 @@ static int parse_argv(int argc, char *argv[]) {
opts.opt->short_code);
}
if (option_parser_get_n_args(&opts) > 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"This subprogram takes no positional arguments.");
return 1;
}
+1
View File
@@ -152,6 +152,7 @@ udevadm monitor -h
udevadm settle
udevadm settle -t 5
udevadm settle -E /sys/class/net/$netdev
(! udevadm settle /no/such/argument)
udevadm settle -h
udevadm test /dev/null