Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of moltke.seatribe.se:src/ashd
[ashd.git]
/
src
/
dirplex
/
dirplex.c
diff --git
a/src/dirplex/dirplex.c
b/src/dirplex/dirplex.c
index
31920e6
..
162e4fd
100644
(file)
--- a/
src/dirplex/dirplex.c
+++ b/
src/dirplex/dirplex.c
@@
-25,6
+25,7
@@
#include <ctype.h>
#include <dirent.h>
#include <time.h>
#include <ctype.h>
#include <dirent.h>
#include <time.h>
+#include <sys/wait.h>
#include <sys/signal.h>
#ifdef HAVE_CONFIG_H
#include <sys/signal.h>
#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;
char *newpath;
int rv;
- if(
!
el == '.') {
+ if(
*
el == '.') {
simpleerror(fd, 404, "Not Found", "The requested URL has no corresponding resource.");
return(1);
}
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);
if(!*el) {
replrest(req, rest);
handledir(req, fd, path);
- return(1);
+ rv = 1;
+ goto out;
}
rv = checkentry(req, fd, path, rest, el);
}
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.");
}
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)
{
}
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);
}
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) {
signal(SIGPIPE, sighandler);
while(1) {
if((fd = recvreq(0, &req)) < 0) {