core/main: correct retval for reexec/switch-root/soft-reboot

For these objectives we ought to execve() at the end, i.e. if we
ever hit the return path something went wrong in do_reexecute().
Let's properly report that via retval.
This commit is contained in:
Mike Yuan
2025-03-08 20:49:30 +01:00
parent 93e19483dc
commit 590e0e3bac
+3 -3
View File
@@ -2235,7 +2235,7 @@ static int invoke_main_loop(
log_notice("Reexecuting.");
*ret_retval = EXIT_SUCCESS;
*ret_retval = EXIT_FAILURE;
*ret_switch_root_dir = *ret_switch_root_init = NULL;
return objective;
@@ -2258,7 +2258,7 @@ static int invoke_main_loop(
log_notice("Switching root.");
*ret_retval = EXIT_SUCCESS;
*ret_retval = EXIT_FAILURE;
/* Steal the switch root parameters */
*ret_switch_root_dir = TAKE_PTR(m->switch_root);
@@ -2278,7 +2278,7 @@ static int invoke_main_loop(
log_notice("Soft-rebooting.");
*ret_retval = EXIT_SUCCESS;
*ret_retval = EXIT_FAILURE;
*ret_switch_root_dir = TAKE_PTR(m->switch_root);
*ret_switch_root_init = NULL;