chiark / gitweb /
systemctl: when called as shutdown, fail if first argument isn't 'now'
authorLennart Poettering <lennart@poettering.net>
Fri, 18 Jun 2010 18:23:39 +0000 (20:23 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 18 Jun 2010 18:23:39 +0000 (20:23 +0200)
src/systemctl.c

index 68e4a909eb6e4b8cc586ba6661ca30277f68af0e..6a7a9bdd6df3ffc893dcc314202ef418dbe3bb13 100644 (file)
@@ -1465,7 +1465,7 @@ static int halt_help(void) {
 
 static int shutdown_help(void) {
 
 
 static int shutdown_help(void) {
 
-        printf("%s [options] [IGNORED] [WALL...]\n\n"
+        printf("%s [options] [now] [WALL...]\n\n"
                "Shut down the system.\n\n"
                "     --help      Show this help\n"
                "  -H --halt      Halt the machine\n"
                "Shut down the system.\n\n"
                "     --help      Show this help\n"
                "  -H --halt      Halt the machine\n"
@@ -1741,6 +1741,11 @@ static int shutdown_parse_argv(int argc, char *argv[]) {
                 }
         }
 
                 }
         }
 
+        if (argc > optind && !streq(argv[optind], "now")) {
+                log_error("Expected 'now' argument.");
+                return -EINVAL;
+        }
+
         /* We ignore the time argument */
         if (argc > optind + 1)
                 arg_wall = argv + optind + 1;
         /* We ignore the time argument */
         if (argc > optind + 1)
                 arg_wall = argv + optind + 1;