systemctl: move telinit execcing out of parse_argv()

With this change, parse_argv() does parsing, without any real actions.
Fully untested ;)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-02-08 12:17:24 +01:00
parent 54d04cd1e7
commit ea71b4604b
4 changed files with 18 additions and 5 deletions
+6 -5
View File
@@ -973,11 +973,8 @@ static int parse_argv(int argc, char *argv[]) {
/* Hmm, so some other init system is running, we need to forward this request
* to it. */
(void) rlimit_nofile_safe();
execv(TELINIT, argv);
return log_error_errno(SYNTHETIC_ERRNO(EIO),
"Couldn't find an alternative telinit implementation to spawn.");
arg_action = ACTION_TELINIT;
return 1;
}
} else if (strstr(program_invocation_short_name, "runlevel")) {
@@ -1143,6 +1140,10 @@ static int run(int argc, char *argv[]) {
r = runlevel_main();
break;
case ACTION_TELINIT:
r = exec_telinit(argv);
break;
case ACTION_EXIT:
case ACTION_SUSPEND:
case ACTION_HIBERNATE: