[systemd-devel] [PATCH] systemctl: bugfix for systemctl reboot command with argument

Sangjung Woo sangjung.woo at samsung.com
Fri Jan 23 03:21:57 PST 2015


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.

Signed-off-by: Sangjung Woo <sangjung.woo at samsung.com>
---
 src/systemctl/systemctl.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index cdc1a50..0764907 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -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 ||
@@ -7071,7 +7077,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     },
-- 
1.7.9.5



More information about the systemd-devel mailing list