diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/util.c | 16 | ||||
-rw-r--r-- | src/shared/util.h | 6 |
2 files changed, 20 insertions, 2 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; +} diff --git a/src/shared/util.h b/src/shared/util.h index 891848a1d8..5b060ef74f 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -917,6 +917,8 @@ char* mount_test_option(const char *haystack, const char *needle); void hexdump(FILE *f, const void *p, size_t s); union file_handle_union { - struct file_handle handle; - char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ]; + struct file_handle handle; + char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ]; }; + +int update_reboot_param_file(const char *param); |