summaryrefslogtreecommitdiff
path: root/monitor_fdpass.c
diff options
context:
space:
mode:
authortim <tim>2002-05-11 22:30:04 +0000
committertim <tim>2002-05-11 22:30:04 +0000
commit9bf43387fde60bfb438b89300ef9f3fe4dbf30b5 (patch)
tree35885229942236e902b422e984f7f064997aeb34 /monitor_fdpass.c
parentcb6b05a4e66b7ab3f26edf34352cf7b48213b6b0 (diff)
downloadopenssh-9bf43387fde60bfb438b89300ef9f3fe4dbf30b5.tar.gz
fix for systems that have both HAVE_ACCRIGHTS_IN_MSGHDR and
HAVE_CONTROL_IN_MSGHDR. Ie. sys/socket.h has #define msg_accrights msg_control
Diffstat (limited to 'monitor_fdpass.c')
-rw-r--r--monitor_fdpass.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index 5401ea46..fb97171f 100644
--- a/monitor_fdpass.c
+++ b/monitor_fdpass.c
@@ -39,13 +39,14 @@ mm_send_fd(int socket, int fd)
struct iovec vec;
char ch = '\0';
int n;
-#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
+#if !defined(HAVE_ACCRIGHTS_IN_MSGHDR) || \
+ (defined(HAVE_ACCRIGHTS_IN_MSGHDR) && defined(HAVE_CONTROL_IN_MSGHDR))
char tmp[CMSG_SPACE(sizeof(int))];
struct cmsghdr *cmsg;
#endif
memset(&msg, 0, sizeof(msg));
-#ifdef HAVE_ACCRIGHTS_IN_MSGHDR
+#if defined(HAVE_ACCRIGHTS_IN_MSGHDR) && !defined(HAVE_CONTROL_IN_MSGHDR)
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
#else
@@ -83,7 +84,8 @@ mm_receive_fd(int socket)
struct iovec vec;
char ch;
int fd, n;
-#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
+#if !defined(HAVE_ACCRIGHTS_IN_MSGHDR) || \
+ (defined(HAVE_ACCRIGHTS_IN_MSGHDR) && defined(HAVE_CONTROL_IN_MSGHDR))
char tmp[CMSG_SPACE(sizeof(int))];
struct cmsghdr *cmsg;
#endif
@@ -93,7 +95,7 @@ mm_receive_fd(int socket)
vec.iov_len = 1;
msg.msg_iov = &vec;
msg.msg_iovlen = 1;
-#ifdef HAVE_ACCRIGHTS_IN_MSGHDR
+#if defined(HAVE_ACCRIGHTS_IN_MSGHDR) && !defined(HAVE_CONTROL_IN_MSGHDR)
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
#else
@@ -107,7 +109,7 @@ mm_receive_fd(int socket)
fatal("%s: recvmsg: expected received 1 got %d",
__FUNCTION__, n);
-#ifdef HAVE_ACCRIGHTS_IN_MSGHDR
+#if defined(HAVE_ACCRIGHTS_IN_MSGHDR) && !defined(HAVE_CONTROL_IN_MSGHDR)
if (msg.msg_accrightslen != sizeof(fd))
fatal("%s: no fd", __FUNCTION__);
#else