diff options
author | Leah Neukirchen <leah@vuxu.org> | 2024-02-08 14:56:14 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2024-02-08 15:27:30 +0100 |
commit | 344154197ddc6c23ab7b0a5e577d0a5dd8790676 (patch) | |
tree | 2153e77705094e8ffbd0595ffe77eadfcacb06d5 | |
parent | debf0231cb0af5f1fe06399a1bca7f84055acb3a (diff) | |
download | nitro-344154197ddc6c23ab7b0a5e577d0a5dd8790676.tar.gz nitro-344154197ddc6c23ab7b0a5e577d0a5dd8790676.tar.xz nitro-344154197ddc6c23ab7b0a5e577d0a5dd8790676.zip |
reap after SIGKILL again
Strictly speaking not needed, but I think it may case the filesystems to remain EBUSY. Also, when running in a container we don't want to leak zombies to the outside (found out by skarnet). We need the alarm and blocking waitpid, since it's possible (in theory) no process has exited between the kill and first call of waitpid(-1, 0, WNOHANG).
-rw-r--r-- | nitro.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nitro.c b/nitro.c index ac8aaae..545ea15 100644 --- a/nitro.c +++ b/nitro.c @@ -1558,6 +1558,14 @@ main(int argc, char *argv[]) prn(2, "- nitro: sending SIGKILL to all processes\n"); kill(-1, SIGKILL); + + alarm(1); + while (1) { + int r = waitpid(-1, 0, 0); + if (r < 0) + break; + } + alarm(0); } if (real_pid1) { prn(2, "- nitro: system %s\n", |