commit dcd2632e5fa0756520ba4c965da7453a6dbc5542
parent 9743a167df9eb1006479b005e4e485b41f1c2fc7
Author: Anton Kling <anton@kling.gg>
Date: Fri, 4 Feb 2022 16:24:25 +0100
BUG FIX: Reap all child processes that exit.
This was previously not done which caused multiple zombie processes to
be created.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/smol_http.c b/smol_http.c
@@ -310,6 +310,10 @@ int init_server(short port, const char *website_root) {
// Disable usage of unveil()(this will also be
// done by our pledge() call)
UNVEIL(NULL, NULL);
+
+ // Reap all child processes that exit
+ signal(SIGCHLD, SIG_IGN);
+
COND_PERROR_EXP(0 != chroot(website_root), "chroot", return 1);
PLEDGE("stdio inet rpath exec id proc", "");