summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2014-03-25 14:15:44 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-21 09:58:53 -0400
commitc5220a940d00fc2520c702104939d0a4cf637254 (patch)
treefb18608caf98d4df1b619a770273272e76541fd0 /src/systemctl
parent370c860f748d149097710dc7952a64f627db9de7 (diff)
systemctl: delete REBOOT_PARAM_FILE if no parameter is specified
And move it to sperate function.
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 1b381f7a90..1717c1929e 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -6018,13 +6018,10 @@ static int halt_parse_argv(int argc, char *argv[]) {
}
}
- if (arg_action == ACTION_REBOOT && argc == optind + 1) {
- r = write_string_file(REBOOT_PARAM_FILE, argv[optind]);
- if (r < 0) {
- log_error("Failed to write reboot param to "
- REBOOT_PARAM_FILE": %s", strerror(-r));
+ if (arg_action == ACTION_REBOOT && (argc == optind || argc == optind + 1)) {
+ r = update_reboot_param_file(argc == optind + 1 ? argv[optind] : NULL);
+ if (r < 0)
return r;
- }
} else if (optind < argc) {
log_error("Too many arguments.");
return -EINVAL;