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: v258-rc1~1139^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F36669%2Fhead;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. --- diff --git a/src/core/main.c b/src/core/main.c index 4db7ad15d25..89b283cca21 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -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;