From 9f4c3da734adbabf457074563f3fb3fae7b85585 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 30 Nov 2011 15:18:45 +1100 Subject: s4-socket: use set_close_on_exec() this prevents a fd leak to child processes --- source4/lib/socket/socket_unix.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib/socket/socket_unix.c') diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c index d492f01268..ab9b06df1b 100644 --- a/source4/lib/socket/socket_unix.c +++ b/source4/lib/socket/socket_unix.c @@ -59,6 +59,8 @@ static NTSTATUS unixdom_init(struct socket_context *sock) sock->backend_name = "unix"; + set_close_on_exec(sock->fd); + return NT_STATUS_OK; } @@ -198,6 +200,8 @@ static NTSTATUS unixdom_accept(struct socket_context *sock, } } + set_close_on_exec(new_fd); + (*new_sock) = talloc(NULL, struct socket_context); if (!(*new_sock)) { close(new_fd); -- cgit