s3:messaging: change unix_dgram_recv_handler() to use recvmsg, not recv
authorMichael Adam <obnox@samba.org>
Tue, 13 May 2014 10:42:32 +0000 (12:42 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 30 May 2014 00:28:15 +0000 (02:28 +0200)
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

source3/lib/unix_msg/unix_msg.c

index 956e3a33527f052b07204e32d0d58d1be4398060..bcabd28da284304bc9e1724acbf247099cc95525 100644 (file)
@@ -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