From 344154197ddc6c23ab7b0a5e577d0a5dd8790676 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 8 Feb 2024 14:56:14 +0100 Subject: 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). --- nitro.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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", -- cgit 1.4.1