1
0
forked from aniani/gmnisrv

ignore SIGCHLD to prevent CGI zombies

with nothing waiting on the forked processes there is no reason not to
reap the CGI process on exit

intended to address issue from mailing list "gmnisrv uses too many
tasks" <163806E8-A16A-463E-8C62-43E903EF1E35@librem.one>
This commit is contained in:
Nolan Prescott 2021-02-07 00:51:10 -05:00 committed by Drew DeVault
parent d1ccb60a52
commit 6d9dd838e4

View File

@ -5,6 +5,7 @@
#include <fcntl.h>
#include <libgen.h>
#include <limits.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
@ -141,6 +142,7 @@ serve_cgi(struct gmnisrv_client *client, const char *path,
return;
}
signal(SIGCHLD, SIG_IGN);
pid_t pid = fork();
if (pid == -1) {
server_error("fork: %s", strerror(errno));