Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
python: Remember to install htredir as well.
[ashd.git]
/
src
/
userplex.c
diff --git
a/src/userplex.c
b/src/userplex.c
index
d6c978c
..
b66490f
100644
(file)
--- a/
src/userplex.c
+++ b/
src/userplex.c
@@
-112,7
+112,7
@@
static int forkchild(char *usrnm)
{
struct passwd *pwd;
pid_t pid;
{
struct passwd *pwd;
pid_t pid;
- int
i,
fd[2];
+ int fd[2];
/* XXX: There should be a way for the child to report errors (like
* 404 when htpub doesn't exist), but for now I don't bother with
/* XXX: There should be a way for the child to report errors (like
* 404 when htpub doesn't exist), but for now I don't bother with
@@
-126,17
+126,15
@@
static int forkchild(char *usrnm)
if((pid = fork()) < 0)
return(-1);
if(pid == 0) {
if((pid = fork()) < 0)
return(-1);
if(pid == 0) {
- for(i = 3; i < FD_SETSIZE; i++) {
- if(i != fd[0])
- close(i);
- }
dup2(fd[0], 0);
close(fd[0]);
dup2(fd[0], 0);
close(fd[0]);
+ close(fd[1]);
login(pwd);
execchild(pwd);
exit(127);
}
close(fd[0]);
login(pwd);
execchild(pwd);
exit(127);
}
close(fd[0]);
+ fcntl(fd[1], F_SETFD, FD_CLOEXEC);
return(fd[1]);
}
return(fd[1]);
}
@@
-145,7
+143,7
@@
static void serve2(struct user *usr, struct hthead *req, int fd)
if(usr->fd < 0)
usr->fd = forkchild(usr->name);
if(sendreq(usr->fd, req, fd)) {
if(usr->fd < 0)
usr->fd = forkchild(usr->name);
if(sendreq(usr->fd, req, fd)) {
- if(
errno == EPIPE
) {
+ if(
(errno == EPIPE) || (errno == ECONNRESET)
) {
/* Assume that the child has crashed and restart it. */
close(usr->fd);
usr->fd = forkchild(usr->name);
/* Assume that the child has crashed and restart it. */
close(usr->fd);
usr->fd = forkchild(usr->name);