summaryrefslogtreecommitdiff
path: root/src/core/shutdown.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-07 16:53:37 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-12 13:43:32 +0200
commit27c06cb516c3b87c34f2a1c2c227152997d05c8c (patch)
treea778f0a66e75528b6ee47e2b0c82668352176127 /src/core/shutdown.c
parent8612da973d30c5a9530fa1b6b3d449147b5a3324 (diff)
core: rework reboot parameter logic a bit
Always warn if something fails, and clarify that the involved utility functions do so in their name. Drop the REBOOT_PARAM_FILE macro. We don't do this for other flag file paths like this, so don't do this for this one either. The path isn't configurable anyway, hence let's make this easier to read by avoiding this one indirection.
Diffstat (limited to 'src/core/shutdown.c')
-rw-r--r--src/core/shutdown.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index 96679c920f..e14755d84e 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -397,9 +397,14 @@ int main(int argc, char *argv[]) {
if (!in_container) {
_cleanup_free_ char *param = NULL;
- if (read_one_line_file(REBOOT_PARAM_FILE, &param) >= 0) {
+ r = read_one_line_file("/run/systemd/reboot-param", &param);
+ if (r < 0)
+ log_warning_errno(r, "Failed to read reboot parameter file: %m");
+
+ if (!isempty(param)) {
log_info("Rebooting with argument '%s'.", param);
syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, param);
+ log_warning_errno(errno, "Failed to reboot with parameter, retrying without: %m");
}
}