[4.1] 78716e0 Close the socket

Lasse Karstensen lkarsten at varnish-software.com
Tue Jun 14 11:19:09 CEST 2016


commit 78716e084ef5d76cfa8285366c758bd08246396c
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 40927a1..9f6358d 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -484,7 +484,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);
@@ -499,12 +499,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