diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-10-07 16:31:47 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-10-08 20:48:41 +0200 |
commit | 27e29a1e4390415e2d5b709f3d8c2d9481b50987 (patch) | |
tree | 60c2ddd8531372aeb22a22fa2c23c1f58aeb8bbb /src/nspawn | |
parent | nspawn: move the main loop body out to a new function (diff) | |
download | systemd-27e29a1e4390415e2d5b709f3d8c2d9481b50987.tar.xz systemd-27e29a1e4390415e2d5b709f3d8c2d9481b50987.zip |
nspawn: fix spurious reboot if container process returns 133
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index d688d2eb64..12d6eab8be 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3965,10 +3965,14 @@ static int run(int master, /* We failed to wait for the container, or the container exited abnormally. */ return r; if (r > 0 || container_status == CONTAINER_TERMINATED) { - /* r > 0 → The container exited with a non-zero status, - * otherwise → The container exited with zero status and reboot was not requested. */ + /* r > 0 → The container exited with a non-zero status. + * As a special case, we need to replace 133 with a different value, + * because 133 is special-cased in the service file to reboot the container. + * otherwise → The container exited with zero status and a reboot was not requested. + */ + if (r == 133) + r = EXIT_FAILURE; /* replace 133 with the general failure code */ *ret = r; - // XXX: if the container returned 133, we will reboot! return 0; /* finito */ } |