]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/main: correct retval for reexec/switch-root/soft-reboot 36669/head
authorMike Yuan <me@yhndnzj.com>
Wed, 5 Mar 2025 17:35:50 +0000 (18:35 +0100)
committerMike Yuan <me@yhndnzj.com>
Sat, 8 Mar 2025 19:49:30 +0000 (20:49 +0100)
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.

src/core/main.c

index 4db7ad15d257a3f6f3b65430a515057a3bd650fe..89b283cca21f24ae739d4efc1e798434e960b69a 100644 (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;