diff options
author | Michael Adam <obnox@samba.org> | 2014-05-31 11:58:01 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-06-02 22:48:12 +0200 |
commit | abedc7116e8a096398e3f8e07b03ba832088e014 (patch) | |
tree | 7ac1d48e67093c9f5301f6d0a8e7f51810ccd4a1 /source3 | |
parent | 51077c6be665fb95c0ba06f5878a08503bf311df (diff) | |
download | samba-abedc7116e8a096398e3f8e07b03ba832088e014.tar.gz samba-abedc7116e8a096398e3f8e07b03ba832088e014.tar.xz samba-abedc7116e8a096398e3f8e07b03ba832088e014.zip |
vfs:aio_fork: simplify checking of MSG_CONTROL and MSG_ACCTRIGHTS
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/vfs_aio_fork.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c index dc33031d67..c3dc188ec9 100644 --- a/source3/modules/vfs_aio_fork.c +++ b/source3/modules/vfs_aio_fork.c @@ -27,6 +27,10 @@ #include "lib/async_req/async_sock.h" #include "lib/util/tevent_unix.h" +#if !defined(HAVE_MSGHDR_MSG_CONTROL) && !defined(HAVE_MSGHDR_MSG_ACCTRIGHTS) +# error Can not pass file descriptors +#endif + #undef recvmsg #ifndef MAP_FILE @@ -152,9 +156,11 @@ static ssize_t read_fd(int fd, void *ptr, size_t nbytes, int *recvfd) ssize_t n; #ifndef HAVE_MSGHDR_MSG_CONTROL int newfd; -#endif -#ifdef HAVE_MSGHDR_MSG_CONTROL + msg.msg_accrights = (caddr_t) &newfd; + msg.msg_accrightslen = sizeof(int); +#else + union { struct cmsghdr cm; char control[CMSG_SPACE(sizeof(int))]; @@ -163,13 +169,6 @@ static ssize_t read_fd(int fd, void *ptr, size_t nbytes, int *recvfd) msg.msg_control = control_un.control; msg.msg_controllen = sizeof(control_un.control); -#else -#if HAVE_MSGHDR_MSG_ACCTRIGHTS - msg.msg_accrights = (caddr_t) &newfd; - msg.msg_accrightslen = sizeof(int); -#else -#error Can not pass file descriptors -#endif #endif msg.msg_name = NULL; |