diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-03-15 14:49:43 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-03-21 18:10:06 +0100 |
commit | 60ffa37a65a96c3af857a3dfc4a6fd47b20cc90e (patch) | |
tree | d458631af11958dd74b89167da1d4c6f967a37bd | |
parent | 36fea15565e6e5a52469c9702f266c5200b313e4 (diff) | |
download | systemd-60ffa37a65a96c3af857a3dfc4a6fd47b20cc90e.tar.gz |
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.
-rw-r--r-- | src/nspawn/nspawn.c | 3 | ||||
-rw-r--r-- | 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 19eb5b6016..dfc4f68ede 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 3c182e802b..486976f65e 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(); \ |