From: phk Date: Thu, 24 Aug 2006 06:15:13 +0000 (+0000) Subject: This is a workaround for what is probably a race in FreeBSD RELENG_6 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5465cede63826fe188bf39c9c72e375238f03f28;p=varnish This is a workaround for what is probably a race in FreeBSD RELENG_6 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 --- diff --git a/varnish-cache/bin/varnishd/cache_acceptor.c b/varnish-cache/bin/varnishd/cache_acceptor.c index 037fa881..c6260182 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.c +++ b/varnish-cache/bin/varnishd/cache_acceptor.c @@ -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; }