diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-06-30 15:19:00 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-06-30 15:19:00 +0200 |
commit | ce9f1527b685402974e15c30b2caf3c1fe3ceb81 (patch) | |
tree | 0ec988f54a229a472b704b99ee6aece5d2883bf9 /src/nspawn | |
parent | 8baaf7a3d8c42970c5215f4dcf84393b84b07e78 (diff) |
nspawn: simplify exit condition check
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 8fb72d6d36..a00a220966 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3309,14 +3309,15 @@ check_container_status: r = wait_for_container(pid, &container_status); pid = 0; - if (r != 0) { - /* If r < 0, explicitly set to EXIT_FAILURE, - * otherwise return the exit code of the - * containered process. */ - if (r < 0) - r = EXIT_FAILURE; + if (r < 0) { + /* We failed to wait for the container, or the + * container exited abnormally */ + r = EXIT_FAILURE; break; - } else if (container_status == CONTAINER_TERMINATED) + } else if (r > 0 || container_status == CONTAINER_TERMINATED) + /* The container exited with a non-zero + * status, or with zero status and no reboot + * was requested. */ break; /* CONTAINER_REBOOTED, loop again */ |