r4635 - trunk/varnish-cache/bin/varnishtest

phk at varnish-cache.org phk at varnish-cache.org
Wed Mar 24 10:21:27 CET 2010


Author: phk
Date: 2010-03-24 10:21:26 +0100 (Wed, 24 Mar 2010)
New Revision: 4635

Modified:
   trunk/varnish-cache/bin/varnishtest/vtc_http.c
   trunk/varnish-cache/bin/varnishtest/vtc_server.c
Log:
Check accept(2) return for failure.

Fixes #668


Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_http.c	2010-03-24 09:18:23 UTC (rev 4634)
+++ trunk/varnish-cache/bin/varnishtest/vtc_http.c	2010-03-24 09:21:26 UTC (rev 4635)
@@ -815,6 +815,8 @@
 	TCP_close(&hp->fd);
 	vtc_log(vl, 4, "Accepting");
 	hp->fd = accept(hp->sfd, NULL, NULL);
+	if (hp->fd < 0)
+		vtc_log(vl, 0, "Accepted failed: %s", strerror(errno));
 	vtc_log(vl, 3, "Accepted socket fd is %d", hp->fd);
 }
 

Modified: trunk/varnish-cache/bin/varnishtest/vtc_server.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_server.c	2010-03-24 09:18:23 UTC (rev 4634)
+++ trunk/varnish-cache/bin/varnishtest/vtc_server.c	2010-03-24 09:21:26 UTC (rev 4635)
@@ -101,7 +101,8 @@
 		addr = (void*)&addr_s;
 		l = sizeof addr_s;
 		fd = accept(s->sock, addr, &l);
-		vtc_log(vl, 3, "Accepted socket fd is %d", fd);
+		if (fd < 0)
+			vtc_log(vl, 0, "Accepted failed: %s", strerror(errno));
 		http_process(vl, s->spec, fd, s->sock);
 		vtc_log(vl, 3, "shutting fd %d", fd);
 		assert((shutdown(fd, SHUT_WR) == 0)




More information about the varnish-commit mailing list