1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 17:51:22 +03:00

nspawn: fix spurious reboot if container process returns 133

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-10-07 10:31:47 -04:00
parent b006762524
commit 27e29a1e43

View File

@ -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 */
}