summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-10-30 10:53:28 +0100
committerGitHub <noreply@github.com>2019-10-30 10:53:28 +0100
commita93503e86f5ee5f46fdb3960d88dbfb2e55198c4 (patch)
treed5897b50841ad898d580ed30b1550f47224c5d49 /src/nspawn/nspawn.c
parent738606e45251b73950a52e62e7186fe4516a018a (diff)
parent2798430e00f7e9186cd3d0f97c1e43897181006f (diff)
downloadsystemd-a93503e86f5ee5f46fdb3960d88dbfb2e55198c4.tar.gz
systemd-a93503e86f5ee5f46fdb3960d88dbfb2e55198c4.tar.bz2
systemd-a93503e86f5ee5f46fdb3960d88dbfb2e55198c4.zip
Merge pull request #13866 from keszybz/nspawn-restarts
Make 'machinectl reboot' functional
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r--src/nspawn/nspawn.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 7760bcaa2d..2ab308a958 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -4618,12 +4618,8 @@ static int run_container(
}
/* Kill if it is not dead yet anyway */
- if (bus) {
- if (arg_register)
- terminate_machine(bus, arg_machine);
- else if (!arg_keep_unit)
- terminate_scope(bus, arg_machine);
- }
+ if (!arg_register && !arg_keep_unit && bus)
+ terminate_scope(bus, arg_machine);
/* Normally redundant, but better safe than sorry */
(void) kill(*pid, SIGKILL);
@@ -4631,6 +4627,10 @@ static int run_container(
r = wait_for_container(*pid, &container_status);
*pid = 0;
+ /* Tell machined that we are gone. */
+ if (bus)
+ (void) unregister_machine(bus, arg_machine);
+
if (r < 0)
/* We failed to wait for the container, or the container exited abnormally. */
return r;