]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/main: correct retval for reexec/switch-root/soft-reboot
authorMike Yuan <me@yhndnzj.com>
Wed, 5 Mar 2025 17:35:50 +0000 (18:35 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sat, 22 Mar 2025 15:51:44 +0000 (15:51 +0000)
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)

src/core/main.c

index ec69eb1cc8318ca470def33e4878c6b40fb2cdc0..63690edf757b412e29fad04b6bf0aa53ecb607d7 100644 (file)
@@ -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;