summaryrefslogtreecommitdiff
path: root/ctdb/tcp
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2015-09-08 10:01:31 +0200
committerMartin Schwenke <martins@samba.org>2015-09-09 10:12:21 +0200
commit7d49d9b4a135f97e6d94ffe14979259ecd3f0cae (patch)
tree81034d8d444cc3b01a6d11f429f817c9c795db08 /ctdb/tcp
parent4010c03e3dcea7d79ca6371f5c57d56b42043822 (diff)
downloadsamba-7d49d9b4a135f97e6d94ffe14979259ecd3f0cae.tar.gz
ctdb-server: fix a possible fd leak in ctdb_tcp_listen_automatic()
sockets are created in a loop until an unused address is found. But the unused socket fds were not closed. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb/tcp')
-rw-r--r--ctdb/tcp/tcp_connect.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index b106f22c86f..277eb375ba9 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -338,6 +338,8 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
DEBUG(DEBUG_ERR,(__location__ " Failed to bind() to socket. %s(%d)\n",
strerror(errno), errno));
}
+
+ close(ctcp->listen_fd);
}
if (i == ctdb->num_nodes) {