summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-08-06 12:42:41 +0200
committerMichael Adam <obnox@samba.org>2014-09-24 08:44:11 +0200
commitc9d08be7d0f5756c19c4c31af8b9034b02ebe33e (patch)
tree848517d676e850c2cb3657cfbd3185bad476057c /source3
parenteca6d83a5f2fb7f85da7067868fdd6143ae726ff (diff)
downloadsamba-c9d08be7d0f5756c19c4c31af8b9034b02ebe33e.tar.gz
s3:unix_msg: add close_fd_array()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/unix_msg/unix_msg.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c
index 8346bb54c53..dd2107bd422 100644
--- a/source3/lib/unix_msg/unix_msg.c
+++ b/source3/lib/unix_msg/unix_msg.c
@@ -135,6 +135,20 @@ static int prepare_socket(int sock)
return prepare_socket_cloexec(sock);
}
+static void close_fd_array(int *fds, size_t num_fds)
+{
+ size_t i;
+
+ for (i = 0; i < num_fds; i++) {
+ if (fds[i] == -1) {
+ continue;
+ }
+
+ close(fds[i]);
+ fds[i] = -1;
+ }
+}
+
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,