From 60ffa37a65a96c3af857a3dfc4a6fd47b20cc90e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 15 Mar 2019 14:49:43 +0100 Subject: [PATCH] main-func: implicitly save argc/argv in DEFINE_MAIN_FUNCTION() functions Let's remove the risk of forgetting to save argc/argv if DEFINE_MAIN_FUNCTION() is used. --- src/nspawn/nspawn.c | 3 --- src/shared/main-func.h | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 19eb5b6..dfc4f68 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -4667,9 +4667,6 @@ static int run(int argc, char *argv[]) { log_parse_environment(); log_open(); - /* Make sure rename_process() in the stub init process can work */ - save_argc_argv(argc, argv); - r = parse_argv(argc, argv); if (r <= 0) goto finish; diff --git a/src/shared/main-func.h b/src/shared/main-func.h index 3c182e8..486976f 100644 --- a/src/shared/main-func.h +++ b/src/shared/main-func.h @@ -8,10 +8,12 @@ #include "spawn-ask-password-agent.h" #include "spawn-polkit-agent.h" #include "static-destruct.h" +#include "util.h" #define _DEFINE_MAIN_FUNCTION(intro, impl, ret) \ int main(int argc, char *argv[]) { \ int r; \ + save_argc_argv(argc, argv); \ intro; \ r = impl; \ static_destruct(); \ -- 2.7.4