From: Mike Yuan Date: Wed, 5 Mar 2025 17:35:50 +0000 (+0100) Subject: core/main: correct retval for reexec/switch-root/soft-reboot X-Git-Tag: v257.5~116 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efcd9c6e62dbc66e5bc70046e8ad1df2ad97947f;p=thirdparty%2Fsystemd.git 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. (cherry picked from commit 590e0e3bacb012bc86ff46f8dbe3f1b415e9cafd) --- diff --git a/src/core/main.c b/src/core/main.c index ec69eb1cc83..63690edf757 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -2229,7 +2229,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; @@ -2252,7 +2252,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); @@ -2272,7 +2272,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;