From 20e056c4a1b63dd2f118b9f5f8854f6bfed3c297 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 10 Jun 2014 21:38:50 +1000 Subject: [PATCH] Close sock in connector loop after we've finished using it --- src/connector.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/connector.c b/src/connector.c index 083f46a0..afb3b9f9 100644 --- a/src/connector.c +++ b/src/connector.c @@ -447,6 +447,7 @@ static int connector_loop(proc_instance_t *pi, conn_instance_t *ci) } } while (selret < 1); retry: + close(sockd); sockd = accept(us->sockd, NULL, NULL); if (sockd < 0) { LOGERR("Failed to accept on connector socket, retrying in 5s"); @@ -455,7 +456,6 @@ retry: } buf = recv_unix_msg(sockd); - close(sockd); if (!buf) { LOGWARNING("Failed to get message in connector_loop"); goto retry; @@ -507,6 +507,7 @@ retry: goto retry; out: + close(sockd); dealloc(buf); return ret; }