From 778f93203200098d93879df2c4bede173f102d07 Mon Sep 17 00:00:00 2001 From: dongshengyuan <545258830@qq.com> Date: Mon, 13 Jul 2026 10:38:46 +0800 Subject: [PATCH] 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 --- src/udev/udevadm-settle.c | 4 ++++ test/units/TEST-17-UDEV.sanity-check.sh | 1 + 2 files changed, 5 insertions(+) diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c index 77882cc074..c23e87c9d6 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 976408fef2..7de2a36722 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