X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fpatplex.c;h=3b3d7f9a5741855c53e7f97e8f7cf928ecebc0a0;hb=578ad6b1de34230e8fe64116b16380c1441ef9dd;hp=d296e04f8c407f8ded35e849035a8d5ae3b95e69;hpb=6174a0392d661ea7cba3cd90ff35ced3b518ca87;p=ashd.git diff --git a/src/patplex.c b/src/patplex.c index d296e04..3b3d7f9 100644 --- a/src/patplex.c +++ b/src/patplex.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H #include @@ -438,7 +439,7 @@ static void serve(struct hthead *req, int fd) return; } - if(childhandle(ch, req, fd)) + if(childhandle(ch, req, fd, NULL, NULL)) simpleerror(fd, 500, "Server Error", "The request handler crashed."); } @@ -464,6 +465,15 @@ static void reloadconf(char *nm) lconfig = cf; } +static void chldhandler(int sig) +{ + pid_t pid; + + do { + pid = waitpid(-1, NULL, WNOHANG); + } while(pid > 0); +} + static void sighandler(int sig) { if(sig == SIGHUP) @@ -511,8 +521,9 @@ int main(int argc, char **argv) flog(LOG_ERR, "could not read `%s'", argv[optind]); exit(1); } - signal(SIGCHLD, SIG_IGN); + signal(SIGCHLD, chldhandler); signal(SIGHUP, sighandler); + signal(SIGPIPE, sighandler); while(1) { if(reload) { reloadconf(argv[optind]);