]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udevadm-settle: reject positional arguments
authordongshengyuan <545258830@qq.com>
Mon, 13 Jul 2026 02:38:46 +0000 (10:38 +0800)
committerdongshengyuan <545258830@qq.com>
Mon, 13 Jul 2026 04:18:49 +0000 (12:18 +0800)
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
test/units/TEST-17-UDEV.sanity-check.sh

index 77882cc074a6c74a294ed4f6e63e25fe6e2da43c..c23e87c9d6c1ff3a0522ce920c4e84e040e0d293 100644 (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;
 }
 
index 976408fef210092a1e3ec3fde7f10159bb33fca1..7de2a36722a33308f4c0d3d2620e623d4d8ca9a2 100755 (executable)
@@ -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