> Thoughts?

Do you know this feeling when you press the start button but you
forgot something? Then your brain starts a background thread and
moment later (like in the shower or during lunch) you realize you
forgot to put some of the laundry in the washing machine...

Cheers,
Dridi
From 3dfece724c34e1c4a9023dd40a23d558856d4783 Mon Sep 17 00:00:00 2001
From: Dridi Boukelmoune <[email protected]>
Date: Thu, 24 Dec 2015 12:41:57 +0100
Subject: [PATCH 7/7] Close the socket

---
 lib/libvmod_debug/vmod_debug.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index 39043ab..485fec0 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -423,7 +423,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);
@@ -438,12 +438,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);
-- 
2.4.3

_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to