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.
This commit is contained in:
Lennart Poettering 2019-03-15 14:49:43 +01:00
parent 36fea15565
commit 60ffa37a65
2 changed files with 2 additions and 3 deletions

View file

@ -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;

View file

@ -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(); \