r4384 - trunk/varnish-cache/lib/libvarnish
    phk at projects.linpro.no 
    phk at projects.linpro.no
       
    Thu Dec  3 12:54:51 CET 2009
    
    
  
Author: phk
Date: 2009-12-03 12:54:51 +0100 (Thu, 03 Dec 2009)
New Revision: 4384
Modified:
   trunk/varnish-cache/lib/libvarnish/tcp.c
Log:
Don't panic in TCP_linger() if the other end closed on us.
Fixes #547
Modified: trunk/varnish-cache/lib/libvarnish/tcp.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/tcp.c	2009-12-03 11:26:53 UTC (rev 4383)
+++ trunk/varnish-cache/lib/libvarnish/tcp.c	2009-12-03 11:54:51 UTC (rev 4384)
@@ -240,8 +240,10 @@
 TCP_linger(int sock, int linger)
 {
 	struct linger lin;
+	int i;
 
 	memset(&lin, 0, sizeof lin);
 	lin.l_onoff = linger;
-	AZ(setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof lin));
+	i = setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof lin);
+	assert(i == 0 || errno == EBADF);
 }
    
    
More information about the varnish-commit
mailing list