From: Lennart Poettering Date: Fri, 15 Mar 2019 09:47:19 +0000 (+0100) Subject: systemctl: use saved_argv where we can X-Git-Tag: v242-rc1~81^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d86e4c979a45ffacf81dcc3c30e748ef0c491c63;p=thirdparty%2Fsystemd.git systemctl: use saved_argv where we can No need to have another variable where we keep the original argv[]. Let's juse reuse the one DEFINE_MAIN_FUNCTION() stores for us anyway. --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index afe6f84f774..c411873c8bd 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -141,7 +141,6 @@ static const char *arg_kill_who = NULL; static int arg_signal = SIGTERM; static char *arg_root = NULL; static usec_t arg_when = 0; -static char *argv_cmdline = NULL; static enum action { ACTION_SYSTEMCTL, ACTION_HALT, @@ -6177,10 +6176,11 @@ static int switch_root(int argc, char *argv[], void *userdata) { init = NULL; } - /* Instruct PID1 to exclude us from its killing spree applied during - * the transition. Otherwise we would exit with a failure status even - * though the switch to the new root has succeed. */ - argv_cmdline[0] = '@'; + /* Instruct PID1 to exclude us from its killing spree applied during the transition. Otherwise we + * would exit with a failure status even though the switch to the new root has succeed. */ + assert(saved_argv); + assert(saved_argv[0]); + saved_argv[0][0] = '@'; r = acquire_bus(BUS_MANAGER, &bus); if (r < 0) @@ -9161,8 +9161,6 @@ static int logind_cancel_shutdown(void) { static int run(int argc, char *argv[]) { int r; - argv_cmdline = argv[0]; - setlocale(LC_ALL, ""); log_parse_environment(); log_open();