summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/socket/socket_ip.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source4/lib/socket/socket_ip.c b/source4/lib/socket/socket_ip.c
index 80f7d333f3..cab51beafb 100644
--- a/source4/lib/socket/socket_ip.c
+++ b/source4/lib/socket/socket_ip.c
@@ -58,7 +58,10 @@ static NTSTATUS ipv4_init(struct socket_context *sock)
static void ip_close(struct socket_context *sock)
{
- close(sock->fd);
+ if (sock->fd != -1) {
+ close(sock->fd);
+ sock->fd = -1;
+ }
}
static NTSTATUS ip_connect_complete(struct socket_context *sock, uint32_t flags)