]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stdio-bridge: minor modernization for parse_argv()
authorMike Yuan <me@yhndnzj.com>
Sat, 12 Apr 2025 17:13:35 +0000 (19:13 +0200)
committerMike Yuan <me@yhndnzj.com>
Sat, 12 Apr 2025 17:15:10 +0000 (19:15 +0200)
src/stdio-bridge/stdio-bridge.c

index f48b7e574e3dbf340b4a4dda758035e2a806142a..71326789cbbed99ec58a69e132a3f41ffd796044 100644 (file)
@@ -92,10 +92,14 @@ static int parse_argv(int argc, char *argv[]) {
                         return -EINVAL;
 
                 default:
-                        return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
-                                               "Unknown option code %c", c);
+                        assert_not_reached();
                 }
 
+        if (argc > optind)
+                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                       "%s takes no arguments.",
+                                       program_invocation_short_name);
+
         return 1;
 }