]> err.no Git - varnish/commitdiff
This is a workaround for what is probably a race in FreeBSD RELENG_6
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 24 Aug 2006 06:15:13 +0000 (06:15 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 24 Aug 2006 06:15:13 +0000 (06:15 +0000)
socket dismantling.

There is no way that close(2) should ever be able to return EINVAL,
but we've seen it.

Specifically assert on EBADF which is the check we're really after.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@910 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_acceptor.c

index 037fa88103b96fcae87274bbf45f6ce8afa7b6fd..c62601820fe6c1843e67c8f1d5ff91828ec492a5 100644 (file)
@@ -141,10 +141,13 @@ vca_pollsession(struct sess *sp)
 void
 vca_close_session(struct sess *sp, const char *why)
 {
+       int i;
 
        VSL(SLT_SessionClose, sp->fd, why);
-       if (sp->fd >= 0)
-               AZ(close(sp->fd));
+       if (sp->fd >= 0) {
+               i = close(sp->fd);
+               assert(i == 0 || errno != EBADF);       /* XXX EINVAL seen */
+       }
        sp->fd = -1;
 }