The branch, master has been updated via e5df09b cmake: Only build test_sendmsg_recvmsg_fd if we have msg_control. via b6161d0 src: Fix setting the temp iovec. from d7e31ed src: Fix build on Solaris.
http://gitweb.samba.org/?p=socket_wrapper.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit e5df09bb2b7aaeef0d3127ad85371eab78702060 Author: Andreas Schneider <a...@samba.org> Date: Tue Jan 21 09:52:06 2014 +0100 cmake: Only build test_sendmsg_recvmsg_fd if we have msg_control. commit b6161d0d94822608053de73b12600661daefabc7 Author: Andreas Schneider <a...@samba.org> Date: Tue Jan 21 09:45:05 2014 +0100 src: Fix setting the temp iovec. ----------------------------------------------------------------------- Summary of changes: src/socket_wrapper.c | 18 +++++++++--------- tests/CMakeLists.txt | 7 +++++-- 2 files changed, 14 insertions(+), 11 deletions(-) Changeset truncated at 500 lines: diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 205d457..2edc8df 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -3342,10 +3342,8 @@ static ssize_t swrap_recvmsg(int s, struct msghdr *omsg, int flags) return libc_recvmsg(s, omsg, flags); } - rc = swrap_recvmsg_before(s, si, omsg, &tmp); - if (rc == -1) { - return -1; - } + tmp.iov_base = NULL; + tmp.iov_len = 0; ZERO_STRUCT(msg); msg.msg_name = (struct sockaddr *)&from_addr; /* optional address */ @@ -3358,8 +3356,10 @@ static ssize_t swrap_recvmsg(int s, struct msghdr *omsg, int flags) msg.msg_flags = omsg->msg_flags; /* flags on received message */ #endif - tmp.iov_base = omsg->msg_iov; - tmp.iov_len = omsg->msg_iovlen; + rc = swrap_recvmsg_before(s, si, &msg, &tmp); + if (rc == -1) { + return -1; + } ret = libc_recvmsg(s, &msg, flags); @@ -3395,6 +3395,9 @@ static ssize_t swrap_sendmsg(int s, const struct msghdr *omsg, int flags) return libc_sendmsg(s, omsg, flags); } + tmp.iov_base = NULL; + tmp.iov_len = 0; + ZERO_STRUCT(msg); msg.msg_name = omsg->msg_name; /* optional address */ msg.msg_namelen = omsg->msg_namelen; /* size of address */ @@ -3406,9 +3409,6 @@ static ssize_t swrap_sendmsg(int s, const struct msghdr *omsg, int flags) msg.msg_flags = omsg->msg_flags; /* flags on received message */ #endif - tmp.iov_base = omsg->msg_iov; - tmp.iov_len = omsg->msg_iovlen; - ret = swrap_sendmsg_before(s, si, &msg, &tmp, &un_addr, &to_un, &to, &bcast); if (ret == -1) return -1; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c626c02..53d458c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,8 +25,11 @@ set(SWRAP_TESTS test_echo_tcp_writev_readv test_echo_udp_sendto_recvfrom test_echo_udp_send_recv - test_echo_udp_sendmsg_recvmsg - test_sendmsg_recvmsg_fd) + test_echo_udp_sendmsg_recvmsg) + +if (HAVE_STRUCT_MSGHDR_MSG_CONTROL) + set(SWRAP_TESTS ${SWRAP_TESTS} test_sendmsg_recvmsg_fd) +endif (HAVE_STRUCT_MSGHDR_MSG_CONTROL) foreach(_SWRAP_TEST ${SWRAP_TESTS}) add_cmocka_test(${_SWRAP_TEST} ${_SWRAP_TEST}.c ${TORTURE_LIBRARY}) -- Socket Wrapper Repository