summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-09-25 00:28:48 +0200
committerMichael Adam <obnox@samba.org>2014-09-30 16:36:10 +0200
commit0ab5e895f7869ea07624c666cc620576a7fde289 (patch)
treed47119ab30d93a854e2f23934963c8bb8d6f2c38
parent6e47886b154ed89182a56233d55c650885432907 (diff)
downloadsamba-0ab5e895f7869ea07624c666cc620576a7fde289.tar.gz
s3:unix_msg: close the fds in unix_dgram_recv_handler() after the callback has run
If the caller wants to use passed fds, he should copy them away and set them to -1. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
-rw-r--r--source3/lib/unix_msg/unix_msg.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c
index be46a43e108..48700683831 100644
--- a/source3/lib/unix_msg/unix_msg.c
+++ b/source3/lib/unix_msg/unix_msg.c
@@ -339,6 +339,12 @@ static void unix_dgram_recv_handler(struct poll_watch *w, int fd, short events,
ctx->recv_callback(ctx, ctx->recv_buf, received,
fds, num_fds, ctx->private_data);
+
+ /*
+ * Close those fds that the callback has not set to -1.
+ */
+ close_fd_array(fds, num_fds);
+
return;
cleanup_fds: