]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: ignore shutdown's "-t" argument (#7459)
authorLennart Poettering <lennart@poettering.net>
Fri, 24 Nov 2017 16:01:32 +0000 (17:01 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 24 Nov 2017 16:01:32 +0000 (17:01 +0100)
We should not only ignore "-t" itself, but also whatever is passed to
it.

This pretty much reverts the core of
a4420f7b8ed73b05ef6f31622101e7804daef69f, and adds back in the status
quo ante. What a difference a ':' can make.

This also adds a quick comment for this, so that we don't make this
mistake again.

Fixes: #7413
src/systemctl/systemctl.c

index ae11bf1ded22ef6cb3a67d1dc61b64aed38c86bb..4fd9b1063406909590c646d8fa2f228cf4040a52 100644 (file)
@@ -8084,7 +8084,7 @@ static int shutdown_parse_argv(int argc, char *argv[]) {
         assert(argc >= 0);
         assert(argv);
 
-        while ((c = getopt_long(argc, argv, "HPrhkKtafFc", options, NULL)) >= 0)
+        while ((c = getopt_long(argc, argv, "HPrhkKat:fFc", options, NULL)) >= 0)
                 switch (c) {
 
                 case ARG_HELP:
@@ -8123,8 +8123,8 @@ static int shutdown_parse_argv(int argc, char *argv[]) {
                         arg_no_wall = true;
                         break;
 
-                case 't':
                 case 'a':
+                case 't': /* Note that we also ignore any passed argument to -t, not just the -t itself */
                 case 'f':
                 case 'F':
                         /* Compatibility nops */