summaryrefslogtreecommitdiffstats
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-12-31 14:19:13 +0100
committerJeremy Allison <jra@samba.org>2015-01-06 00:33:10 +0100
commit8caa866b08172dd5da5ef2cfadad4210c1dabf08 (patch)
tree6b11434c89c8525d313270579e0968699b6f5227 /source3/lib
parent37af87e75e6efb7393f6e7572aaa4bef8f38920f (diff)
downloadsamba-8caa866b08172dd5da5ef2cfadad4210c1dabf08.tar.gz
samba-8caa866b08172dd5da5ef2cfadad4210c1dabf08.tar.xz
samba-8caa866b08172dd5da5ef2cfadad4210c1dabf08.zip
lib: Use msghdr_prep_recv_fds in unix_msg
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/unix_msg/unix_msg.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c
index c5f8143e0f..51bb0c6fbc 100644
--- a/source3/lib/unix_msg/unix_msg.c
+++ b/source3/lib/unix_msg/unix_msg.c
@@ -272,9 +272,8 @@ static void unix_dgram_recv_handler(struct poll_watch *w, int fd, short events,
int flags = 0;
struct msghdr msg;
struct iovec iov;
-#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
- char buf[CMSG_SPACE(sizeof(int)*INT8_MAX)] = { 0, };
-#endif /* HAVE_STRUCT_MSGHDR_MSG_CONTROL */
+ size_t bufsize = msghdr_prep_recv_fds(NULL, NULL, 0, INT8_MAX);
+ uint8_t buf[bufsize];
iov = (struct iovec) {
.iov_base = (void *)ctx->recv_buf,
@@ -284,12 +283,10 @@ static void unix_dgram_recv_handler(struct poll_watch *w, int fd, short events,
msg = (struct msghdr) {
.msg_iov = &iov,
.msg_iovlen = 1,
-#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
- .msg_control = buf,
- .msg_controllen = sizeof(buf),
-#endif
};
+ msghdr_prep_recv_fds(&msg, buf, bufsize, INT8_MAX);
+
#ifdef MSG_CMSG_CLOEXEC
flags |= MSG_CMSG_CLOEXEC;
#endif