s3:unix_msg: close the fds in unix_dgram_recv_handler() after the callback has run
authorMichael Adam <obnox@samba.org>
Wed, 24 Sep 2014 22:28:48 +0000 (00:28 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 30 Sep 2014 14:36:10 +0000 (16:36 +0200)
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>
source3/lib/unix_msg/unix_msg.c

index be46a43e1089644b228f83f94c8c9b0706569f90..48700683831875c1bce96f19eaa4ae4b50915633 100644 (file)
@@ -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: