summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-23 19:50:10 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-29 21:55:51 +0200
commit97792515b4885db5661897eaafa9be14acb1b0ff (patch)
tree7673ff173a1377364292d297a65df0a5816b12a2
parent5f5d8eab1f2f5f5e088bc301533b3e4636de96c7 (diff)
core: properly use the ExitCode bus property when exiting is --user instance
-rw-r--r--src/core/main.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 4fe298117c..9634feb8a6 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1168,7 +1168,6 @@ int main(int argc, char *argv[]) {
char *switch_root_dir = NULL, *switch_root_init = NULL;
struct rlimit saved_rlimit_nofile = RLIMIT_MAKE_CONST(0);
const char *error_message = NULL;
- uint8_t shutdown_exit_code = 0;
#ifdef HAVE_SYSV_COMPAT
if (getpid() != 1 && strstr(program_invocation_short_name, "init")) {
@@ -1720,8 +1719,9 @@ int main(int argc, char *argv[]) {
goto finish;
case MANAGER_EXIT:
+ retval = m->return_value;
+
if (m->running_as == MANAGER_USER) {
- retval = EXIT_SUCCESS;
log_debug("Exit.");
goto finish;
}
@@ -1754,10 +1754,8 @@ int main(int argc, char *argv[]) {
finish:
pager_close();
- if (m) {
+ if (m)
arg_shutdown_watchdog = m->shutdown_watchdog;
- shutdown_exit_code = m->return_value;
- }
m = manager_free(m);
@@ -1930,7 +1928,7 @@ finish:
if (streq(shutdown_verb, "exit")) {
command_line[pos++] = "--exit-code";
command_line[pos++] = exit_code;
- xsprintf(exit_code, "%d", shutdown_exit_code);
+ xsprintf(exit_code, "%d", retval);
}
assert(pos < ELEMENTSOF(command_line));