summaryrefslogtreecommitdiff
path: root/monitor_fdpass.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-11-23 14:03:19 +1100
committerDarren Tucker <dtucker@zip.com.au>2008-11-23 14:03:19 +1100
commit69087eae6d44c2266b1bea1a3b3de5a7b7e551e1 (patch)
treea1038094d7554b643018f85746876bcb7ea2f1f9 /monitor_fdpass.c
parent0f4d2c02f275ad9f80ccd7435ffb407a8be61e9a (diff)
- (dtucker) [monitor_fdpass.c] Reduce diff vs OpenBSD by moving some
declarations, removing an unnecessary union member and adding whitespace. ok djm some time ago.
Diffstat (limited to 'monitor_fdpass.c')
-rw-r--r--monitor_fdpass.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index cab538bc..f68c3728 100644
--- a/monitor_fdpass.c
+++ b/monitor_fdpass.c
@@ -45,17 +45,16 @@ mm_send_fd(int sock, int fd)
{
#if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
struct msghdr msg;
- struct iovec vec;
- char ch = '\0';
- ssize_t n;
#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
union {
struct cmsghdr hdr;
- char tmp[CMSG_SPACE(sizeof(int))];
char buf[CMSG_SPACE(sizeof(int))];
} cmsgbuf;
struct cmsghdr *cmsg;
#endif
+ struct iovec vec;
+ char ch = '\0';
+ ssize_t n;
memset(&msg, 0, sizeof(msg));
#ifdef HAVE_ACCRIGHTS_IN_MSGHDR
@@ -99,10 +98,6 @@ mm_receive_fd(int sock)
{
#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
struct msghdr msg;
- struct iovec vec;
- ssize_t n;
- char ch;
- int fd;
#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
union {
struct cmsghdr hdr;
@@ -110,6 +105,10 @@ mm_receive_fd(int sock)
} cmsgbuf;
struct cmsghdr *cmsg;
#endif
+ struct iovec vec;
+ ssize_t n;
+ char ch;
+ int fd;
memset(&msg, 0, sizeof(msg));
vec.iov_base = &ch;
@@ -128,6 +127,7 @@ mm_receive_fd(int sock)
error("%s: recvmsg: %s", __func__, strerror(errno));
return -1;
}
+
if (n != 1) {
error("%s: recvmsg: expected received 1 got %ld",
__func__, (long)n);
@@ -145,6 +145,7 @@ mm_receive_fd(int sock)
error("%s: no message header", __func__);
return -1;
}
+
#ifndef BROKEN_CMSG_TYPE
if (cmsg->cmsg_type != SCM_RIGHTS) {
error("%s: expected type %d got %d", __func__,