summaryrefslogtreecommitdiff
path: root/src/shared/util.c
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/shared/util.c
parent370c860f748d149097710dc7952a64f627db9de7 (diff)
systemctl: delete REBOOT_PARAM_FILE if no parameter is specified
And move it to sperate function.
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index c20dff2f7c..b6285abb29 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -6397,3 +6397,19 @@ void hexdump(FILE *f, const void *p, size_t s) {
s -= 16;
}
}
+
+int update_reboot_param_file(const char *param)
+{
+ int r = 0;
+
+ if (param) {
+
+ r = write_string_file(REBOOT_PARAM_FILE, param);
+ if (r < 0)
+ log_error("Failed to write reboot param to "
+ REBOOT_PARAM_FILE": %s", strerror(-r));
+ } else
+ unlink(REBOOT_PARAM_FILE);
+
+ return r;
+}