From: Daan De Meyer Date: Thu, 11 May 2023 06:47:38 +0000 (+0200) Subject: core: Make sure systemctl exit works outside of a container X-Git-Tag: v254-rc1~504 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f92250f4c10a723693b734b803c98f3b0d53f3e;p=thirdparty%2Fsystemd.git core: Make sure systemctl exit works outside of a container When running in a VM, we now support propagating the exit status via a vsock notify socket, so drop the restrictions on propagating an exit status when not in a container to make sure this works properly. --- diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index fb608cd295b..b18aa1d4ff2 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -1943,9 +1943,6 @@ static int method_set_exit_code(sd_bus_message *message, void *userdata, sd_bus_ if (r < 0) return r; - if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0) - return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED, "ExitCode can only be set for user service managers or in containers."); - m->return_value = code; return sd_bus_reply_method_return(message, NULL); diff --git a/src/core/main.c b/src/core/main.c index 5274bcc106f..e86e0d941ec 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1515,10 +1515,8 @@ static int become_shutdown(int objective, int retval) { if (log_get_show_time()) command_line[pos++] = "--log-time"; - if (objective == MANAGER_EXIT) { - xsprintf(exit_code, "--exit-code=%d", retval); - command_line[pos++] = exit_code; - } + xsprintf(exit_code, "--exit-code=%d", retval); + command_line[pos++] = exit_code; assert(pos < ELEMENTSOF(command_line));