summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-09-29 13:31:27 +0200
committerMichael Adam <obnox@samba.org>2014-09-30 16:36:10 +0200
commitb38ed7311af0862945e417b6f6350b7bc6b0be20 (patch)
tree0894ef0b1f58148d742a92a78856aafa3a150687
parent20cd934ec04e601a6bac6fc1dd61c75767c6213f (diff)
downloadsamba-b38ed7311af0862945e417b6f6350b7bc6b0be20.tar.gz
samba-b38ed7311af0862945e417b6f6350b7bc6b0be20.tar.xz
samba-b38ed7311af0862945e417b6f6350b7bc6b0be20.zip
s3:unix_msg: add close_fd_array_cmsg()
Variant of close_fd_array() operating on fd_array inside msghdr. 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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c
index 6d1f3adce4..ca7f85dea3 100644
--- a/source3/lib/unix_msg/unix_msg.c
+++ b/source3/lib/unix_msg/unix_msg.c
@@ -177,6 +177,19 @@ static void close_fd_array(int *fds, size_t num_fds)
}
}
+static void close_fd_array_cmsg(struct msghdr *msg)
+{
+ int *fds = NULL;
+ size_t num_fds = 0;
+
+ extract_fd_array_from_msghdr(msg, &fds, &num_fds);
+
+ /*
+ * TODO: caveat - side-effect - changing msg ???
+ */
+ close_fd_array(fds, num_fds);
+}
+
static int unix_dgram_init(const struct sockaddr_un *addr, size_t max_msg,
const struct poll_funcs *ev_funcs,
void (*recv_callback)(struct unix_dgram_ctx *ctx,