mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-10 00:58:20 +03:00
system-update-generator: use the new main function definer
This commit is contained in:
parent
7a44c7e31f
commit
bd020018f2
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user