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.
This commit is contained in:
Lennart Poettering
2019-03-21 18:10:06 +01:00
parent 60ffa37a65
commit d86e4c979a
+5 -7
View File
@@ -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();