chiark / gitweb /
systemctl: bugfix for systemctl reboot command with argument
authorSangjung Woo <sangjung.woo@samsung.com>
Fri, 23 Jan 2015 11:21:57 +0000 (20:21 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 23 Jan 2015 14:30:44 +0000 (09:30 -0500)
According to systemctl man page, 'systemctl reboot [arg]' should work
without any errors. However, it does not work because of 'Invalid number
of arguments' error, except for 'reboot [arg]'. This patch fixes the bug
so that both of commands work in exactly the same way.

src/systemctl/systemctl.c

index 44b65bb44422aeb0001ba27798941e2103dede64..66c0b9949e44dd3b3e06c7ac547a0bebbca2cd58 100644 (file)
@@ -2955,6 +2955,12 @@ static int start_special(sd_bus *bus, char **args) {
                 return -EPERM;
         }
 
+        if (a == ACTION_REBOOT) {
+                r = update_reboot_param_file(args[1]);
+                if (r < 0)
+                        return r;
+        }
+
         if (arg_force >= 2 &&
             (a == ACTION_HALT ||
              a == ACTION_POWEROFF ||
@@ -7093,7 +7099,7 @@ static int systemctl_main(sd_bus *bus, int argc, char *argv[], int bus_error) {
                 { "import-environment",    MORE,  1, import_environment},
                 { "halt",                  EQUAL, 1, start_special,    FORCE },
                 { "poweroff",              EQUAL, 1, start_special,    FORCE },
-                { "reboot",                EQUAL, 1, start_special,    FORCE },
+                { "reboot",                MORE,  1, start_special,    FORCE },
                 { "kexec",                 EQUAL, 1, start_special     },
                 { "suspend",               EQUAL, 1, start_special     },
                 { "hibernate",             EQUAL, 1, start_special     },