[master] f6a7b61 Close the socket

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Mar 29 14:20:05 CEST 2016


commit f6a7b615cfdc883955fdbc29e5e73045379d0f70
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Dec 24 12:41:57 2015 +0100

    Close the socket

diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index 1f671ae..0ce0271 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -486,7 +486,7 @@ vmod_barrier_sync(VRT_CTX, VCL_STRING addr)
 {
 	const char *err;
 	char buf[32];
-	int sock;
+	int sock, i;
 	ssize_t sz;
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
@@ -501,12 +501,13 @@ vmod_barrier_sync(VRT_CTX, VCL_STRING addr)
 	}
 
 	sz = read(sock, buf, sizeof buf);
+	i = errno;
+	AZ(close(sock));
 	if (sz == 0)
 		return (1);
 	if (sz < 0)
 		VSLb(ctx->vsl, SLT_Error,
-		    "Barrier connection failed: %s (errno=%d)",
-		    strerror(errno), errno);
+		    "Barrier connection failed: %s (errno=%d)", strerror(i), i);
 	if (sz > 0)
 		VSLb(ctx->vsl, SLT_Error, "Barrier unexpected data (%ldB)", sz);
 	return (0);



More information about the varnish-commit mailing list