summaryrefslogtreecommitdiff
path: root/monitor_fdpass.c
diff options
context:
space:
mode:
authorTim Rice <tim@multitalents.net>2002-05-11 15:30:04 -0700
committerTim Rice <tim@multitalents.net>2002-05-11 15:30:04 -0700
commit802b9568686032c81e4a998dc282df6ed63d4090 (patch)
tree2ebf89f297c3aa4fb414b9b390ee85e8f3cabdad /monitor_fdpass.c
parentaef7371fe45f8df19c166daa0e72a81d121a9c2f (diff)
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