From: dongshengyuan <545258830@qq.com> Date: Mon, 13 Jul 2026 02:38:46 +0000 (+0800) Subject: udevadm-settle: reject positional arguments X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=778f93203200098d93879df2c4bede173f102d07;p=thirdparty%2Fsystemd.git 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: c71509028fc2741b25dd537f9e1b7e8896df745e --- diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c index 77882cc074a..c23e87c9d6c 100644 --- a/src/udev/udevadm-settle.c +++ b/src/udev/udevadm-settle.c @@ -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; } diff --git a/test/units/TEST-17-UDEV.sanity-check.sh b/test/units/TEST-17-UDEV.sanity-check.sh index 976408fef21..7de2a36722a 100755 --- a/test/units/TEST-17-UDEV.sanity-check.sh +++ b/test/units/TEST-17-UDEV.sanity-check.sh @@ -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