1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 10:51:20 +03:00

debug-generator: port over to using static destructors

This commit is contained in:
Lennart Poettering 2018-11-19 20:48:12 +01:00
parent f60947d970
commit 4197fde5c7

View File

@ -17,6 +17,10 @@ static char **arg_mask = NULL;
static char **arg_wants = NULL; static char **arg_wants = NULL;
static bool arg_debug_shell = false; static bool arg_debug_shell = false;
STATIC_DESTRUCTOR_REGISTER(arg_default_unit, freep);
STATIC_DESTRUCTOR_REGISTER(arg_mask, strv_freep);
STATIC_DESTRUCTOR_REGISTER(arg_wants, strv_freep);
static int parse_proc_cmdline_item(const char *key, const char *value, void *data) { static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {
int r; int r;
@ -161,24 +165,14 @@ static int run(int argc, char *argv[]) {
if (arg_debug_shell) { if (arg_debug_shell) {
r = strv_extend(&arg_wants, "debug-shell.service"); r = strv_extend(&arg_wants, "debug-shell.service");
if (r < 0) { if (r < 0)
r = log_oom(); return log_oom();
goto finish;
}
} }
r = generate_mask_symlinks(); r = generate_mask_symlinks();
q = generate_wants_symlinks(); q = generate_wants_symlinks();
if (q < 0)
r = q;
finish: return r < 0 ? r : q;
arg_default_unit = mfree(arg_default_unit);
strv_free(arg_wants);
strv_free(arg_mask);
return r;
} }
DEFINE_MAIN_FUNCTION(run); DEFINE_MAIN_FUNCTION(run);