Commit 78716e08 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune Committed by Lasse Karstensen

Close the socket

parent 93b77d9a
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment