From 5fa0d3d56824f4ef3dfdb0f97c836554a62c4875 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze@samba.org>
Date: Sat, 3 Jan 2009 12:47:24 +0100
Subject: s4:socket: use a socket_wrapper aware function to auto close the fd
 event for sockets

metze
---
 source4/lib/socket/socket.c | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'source4/lib/socket/socket.c')

diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c
index 26cdac99a3..9d30e0a77e 100644
--- a/source4/lib/socket/socket.c
+++ b/source4/lib/socket/socket.c
@@ -37,6 +37,15 @@ static int socket_destructor(struct socket_context *sock)
 	return 0;
 }
 
+_PUBLIC_ void socket_tevent_fd_close_fn(struct tevent_context *ev,
+					struct tevent_fd *fde,
+					int fd,
+					void *private_data)
+{
+	/* this might be the socket_wrapper swrap_close() */
+	close(fd);
+}
+
 _PUBLIC_ NTSTATUS socket_create_with_ops(TALLOC_CTX *mem_ctx, const struct socket_ops *ops,
 					 struct socket_context **new_sock, 
 					 enum socket_type type, uint32_t flags)
-- 
cgit