On Tue, Mar 25, 2014 at 02:15:44PM +0100, Michael Olbrich wrote: > And move it to sperate function.
Ping! No comments at all? Michael > --- > src/shared/util.c | 16 ++++++++++++++++ > src/shared/util.h | 2 ++ > src/systemctl/systemctl.c | 9 +++------ > 3 files changed, 21 insertions(+), 6 deletions(-) > > diff --git a/src/shared/util.c b/src/shared/util.c > index ffe6624..0260d17 100644 > --- a/src/shared/util.c > +++ b/src/shared/util.c > @@ -6391,3 +6391,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 90464c9..a557f70 100644 > --- a/src/shared/util.h > +++ b/src/shared/util.h > @@ -922,3 +922,5 @@ uint64_t physical_memory(void); > char* mount_test_option(const char *haystack, const char *needle); > > void hexdump(FILE *f, const void *p, size_t s); > + > +int update_reboot_param_file(const char *param); > diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c > index 0887bc3..89de20e 100644 > --- a/src/systemctl/systemctl.c > +++ b/src/systemctl/systemctl.c > @@ -5973,13 +5973,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; > -- > 1.9.1 > > _______________________________________________ > systemd-devel mailing list > systemd-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/systemd-devel > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel