From: Eelco Dolstra Date: Thu, 14 Aug 2014 17:59:16 +0000 (+0200) Subject: machine_kill(): Don't kill the unit when killing the leader X-Git-Tag: v216~111 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=9d685ca8193c0da3ad5746be3871f5350179a3b3;ds=sidebyside machine_kill(): Don't kill the unit when killing the leader If "machinectl poweroff" or "machinectl reboot" is used on a systemd-nspawn container started with --keep-unit and --register, it should *only* send the appropriate signal to the leader PID (i.e. the container's systemd process). It shouldn't fall through to manager_kill_unit() to also send the signal to the unit. The latter ends up killing systemd-nspawn, which takes down the container prematurely. --- diff --git a/src/machine/machine.c b/src/machine/machine.c index 1c9177e1c..13d3448ad 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -493,6 +493,8 @@ int machine_kill(Machine *m, KillWho who, int signo) { if (kill(m->leader, signo) < 0) return -errno; + + return 0; } /* Otherwise make PID 1 do it for us, for the entire cgroup */