~sircmpwn/gmnisrv

6d9dd838e439bbc730d12ce81214046cde9227dd — Nolan Prescott 2 years ago d1ccb60
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>
1 files changed, 2 insertions(+), 0 deletions(-)

M src/serve.c
M src/serve.c => src/serve.c +2 -0
@@ 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));