-static void forkchild(struct child *ch)
-{
- ch->fd = stdmkchild(ch->argv);
-}
-
-static void passreq(struct child *ch, struct hthead *req, int fd)
-{
- if(ch->fd < 0)
- forkchild(ch);
- if(sendreq(ch->fd, req, fd)) {
- if(errno == EPIPE) {
- /* Assume that the child has crashed and restart it. */
- forkchild(ch);
- if(!sendreq(ch->fd, req, fd))
- return;
- }
- flog(LOG_ERR, "could not pass on request to child %s: %s", ch->name, strerror(errno));
- close(ch->fd);
- ch->fd = -1;
- simpleerror(fd, 500, "Server Error", "The request handler crashed.");
- }
-}
-