geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit 9556d3960086cdf6365a612823915fd6a9906bac
parent 0bbe73dae350eaa6ae6cf712d91b90c9ae760c53
Author: Christoph Lohmann <20h@r-36.net>
Date:   Mon,  7 Mar 2011 22:01:11 +0100

Running scripts should now exit as expected.

Diffstat:
handlr.c | 13++++++++++++-
main.c | 1+
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/handlr.c b/handlr.c @@ -15,6 +15,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> +#include <sys/wait.h> #include "ind.h" #include "arg.h" @@ -177,6 +178,16 @@ handlecgi(int sock, char *file, char *port, char *base, char *args, if(sear == nil) sear = ""; - execl(file, p, sear, args, (char *)nil); + switch(fork()) { + case 0: + execl(file, p, sear, args, (char *)nil); + case -1: + break; + default: + wait(NULL); + shutdown(sock, SHUT_RDWR); + close(sock); + break; + } } diff --git a/main.c b/main.c @@ -212,6 +212,7 @@ sighandler(int sig) case SIGQUIT: case SIGABRT: case SIGTERM: + case SIGKILL: if(logfile != nil) stoplogging(glfd); if(listfd >= 0)