From bd2231244204eaee2bd82c7d769d8e8ae5e81fcf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 13 May 2014 12:42:32 +0200 Subject: [PATCH] s3:messaging: change unix_dgram_recv_handler() to use recvmsg, not recv This is in preparation of adding fd-passing to messaging. Signed-off-by: Michael Adam Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri May 30 02:28:15 CEST 2014 on sn-devel-104 --- source3/lib/unix_msg/unix_msg.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c index 956e3a33527..bcabd28da28 100644 --- a/source3/lib/unix_msg/unix_msg.c +++ b/source3/lib/unix_msg/unix_msg.c @@ -233,8 +233,22 @@ static void unix_dgram_recv_handler(struct poll_watch *w, int fd, short events, { struct unix_dgram_ctx *ctx = (struct unix_dgram_ctx *)private_data; ssize_t received; + struct msghdr msg; + struct iovec iov; + + iov = (struct iovec) { + .iov_base = (void *)ctx->recv_buf, + .iov_len = ctx->max_msg, + }; + + msg = (struct msghdr) { + .msg_iov = &iov, + .msg_iovlen = 1, + .msg_control = NULL, + .msg_controllen = 0, + }; - received = recv(fd, ctx->recv_buf, ctx->max_msg, 0); + received = recvmsg(fd, &msg, 0); if (received == -1) { if ((errno == EAGAIN) || #ifdef EWOULDBLOCK -- 2.11.4.GIT