diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-19 20:48:12 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-19 21:14:34 +0100 |
commit | 4197fde5c7354b21c53f6ed3e72d86c33b17113b (patch) | |
tree | 410199d73946a11cec522c75301edd27b435b1e9 /src/debug-generator | |
parent | debug-generator: port over to DEFINE_MAIN_FUNCTION() (diff) | |
download | systemd-4197fde5c7354b21c53f6ed3e72d86c33b17113b.tar.xz systemd-4197fde5c7354b21c53f6ed3e72d86c33b17113b.zip |
debug-generator: port over to using static destructors
Diffstat (limited to 'src/debug-generator')
-rw-r--r-- | src/debug-generator/debug-generator.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c index 8b6d26e19b..73a8d35271 100644 --- a/src/debug-generator/debug-generator.c +++ b/src/debug-generator/debug-generator.c @@ -17,6 +17,10 @@ static char **arg_mask = NULL; static char **arg_wants = NULL; 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) { int r; @@ -161,24 +165,14 @@ static int run(int argc, char *argv[]) { if (arg_debug_shell) { r = strv_extend(&arg_wants, "debug-shell.service"); - if (r < 0) { - r = log_oom(); - goto finish; - } + if (r < 0) + return log_oom(); } r = generate_mask_symlinks(); - q = generate_wants_symlinks(); - if (q < 0) - r = q; - -finish: - arg_default_unit = mfree(arg_default_unit); - strv_free(arg_wants); - strv_free(arg_mask); - return r; + return r < 0 ? r : q; } DEFINE_MAIN_FUNCTION(run); |