summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-05-13 12:42:32 +0200
committerJeremy Allison <jra@samba.org>2014-05-30 02:28:15 +0200
commitbd2231244204eaee2bd82c7d769d8e8ae5e81fcf (patch)
tree555405d461a3edb4afc57a61fcf57405f2c97977
parente4453bdc3719c57be575101c0519debae6b0c259 (diff)
downloadsamba-bd2231244204eaee2bd82c7d769d8e8ae5e81fcf.tar.gz
samba-bd2231244204eaee2bd82c7d769d8e8ae5e81fcf.tar.xz
samba-bd2231244204eaee2bd82c7d769d8e8ae5e81fcf.zip
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 <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri May 30 02:28:15 CEST 2014 on sn-devel-104
-rw-r--r--source3/lib/unix_msg/unix_msg.c16
1 files changed, 15 insertions, 1 deletions
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