lib: Check for ECONNRESET as well to detect crashed children.
authorFredrik Tolf <fredrik@dolda2000.com>
Sat, 23 Oct 2010 15:00:28 +0000 (17:00 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Sat, 23 Oct 2010 15:00:28 +0000 (17:00 +0200)
lib/cf.c
src/userplex.c

index 432f78a..fd53c54 100644 (file)
--- a/lib/cf.c
+++ b/lib/cf.c
@@ -332,7 +332,7 @@ int childhandle(struct child *ch, struct hthead *req, int fd, void (*chinit)(voi
        if(ch->fd < 0)
            ch->fd = stdmkchild(ch->argv, chinit, idata);
        if(sendreq(ch->fd, req, fd)) {
-           if(errno == EPIPE) {
+           if((errno == EPIPE) || (errno == ECONNRESET)) {
                /* Assume that the child has crashed and restart it. */
                close(ch->fd);
                ch->fd = stdmkchild(ch->argv, chinit, idata);
index d6c978c..3a2da87 100644 (file)
@@ -145,7 +145,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(errno == EPIPE) {
+       if((errno == EPIPE) || (errno == ECONNRESET)) {
            /* Assume that the child has crashed and restart it. */
            close(usr->fd);
            usr->fd = forkchild(usr->name);