X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fdirplex%2Fdirplex.c;h=162e4fd9dd1200796afb213d0e24c3925ef52b2c;hb=c6cb01ef6ac92d48f1eb82e173662023547355fc;hp=31920e625e717bab485ae6e56a6058c003674fd3;hpb=fd735432ca61308348e1f1eb1b79a42e357aa0b7;p=ashd.git diff --git a/src/dirplex/dirplex.c b/src/dirplex/dirplex.c index 31920e6..162e4fd 100644 --- a/src/dirplex/dirplex.c +++ b/src/dirplex/dirplex.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #ifdef HAVE_CONFIG_H @@ -184,7 +185,7 @@ static int checkentry(struct hthead *req, int fd, char *path, char *rest, char * char *newpath; int rv; - if(!el == '.') { + if(*el == '.') { simpleerror(fd, 404, "Not Found", "The requested URL has no corresponding resource."); return(1); } @@ -279,7 +280,8 @@ static int checkpath(struct hthead *req, int fd, char *path, char *rest) if(!*el) { replrest(req, rest); handledir(req, fd, path); - return(1); + rv = 1; + goto out; } rv = checkentry(req, fd, path, rest, el); @@ -296,6 +298,15 @@ static void serve(struct hthead *req, int fd) simpleerror(fd, 404, "Not Found", "The requested URL has no corresponding resource."); } +static void chldhandler(int sig) +{ + pid_t pid; + + do { + pid = waitpid(-1, NULL, WNOHANG); + } while(pid > 0); +} + static void sighandler(int sig) { } @@ -359,7 +370,7 @@ int main(int argc, char **argv) flog(LOG_ERR, "could not change directory to %s: %s", argv[optind], strerror(errno)); exit(1); } - signal(SIGCHLD, SIG_IGN); + signal(SIGCHLD, chldhandler); signal(SIGPIPE, sighandler); while(1) { if((fd = recvreq(0, &req)) < 0) {