diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/system-update-generator/system-update-generator.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/system-update-generator/system-update-generator.c b/src/system-update-generator/system-update-generator.c index 80f53cf34c..77e265d710 100644 --- a/src/system-update-generator/system-update-generator.c +++ b/src/system-update-generator/system-update-generator.c @@ -15,7 +15,7 @@ * Implements the logic described in systemd.offline-updates(7). */ -static const char *arg_dest = "/tmp"; +static const char *arg_dest = NULL; static int generate_symlink(void) { const char *p = NULL; @@ -51,26 +51,20 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat return 0; } -int main(int argc, char *argv[]) { - int r, k; +static int run(const char *dest, const char *dest_early, const char *dest_late) { + int r; - log_setup_generator(); - - if (argc > 1 && argc != 4) { - log_error("This program takes three or no arguments."); - return EXIT_FAILURE; - } - - if (argc > 1) - arg_dest = argv[2]; + assert_se(arg_dest = dest_early); r = generate_symlink(); + if (r < 0) + return r; - if (r > 0) { - k = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0); - if (k < 0) - log_warning_errno(k, "Failed to parse kernel command line, ignoring: %m"); - } + r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0); + if (r < 0) + log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); - return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; + return 0; } + +DEFINE_MAIN_GENERATOR_FUNCTION(run); |