- (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.
This commit is contained in:
Darren Tucker 2008-11-23 14:03:19 +11:00
parent 0f4d2c02f2
commit 69087eae6d
2 changed files with 15 additions and 9 deletions

View File

@ -1,3 +1,8 @@
20081123
- (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.
20081118 20081118
- (tim) [addrmatch.c configure.ac] Some platforms do not have sin6_scope_id - (tim) [addrmatch.c configure.ac] Some platforms do not have sin6_scope_id
member of sockaddr_in6. Also reported in Bug 1491 by David Leonard. OK and member of sockaddr_in6. Also reported in Bug 1491 by David Leonard. OK and
@ -4926,5 +4931,5 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@ passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.5142 2008/11/19 05:26:41 tim Exp $ $Id: ChangeLog,v 1.5143 2008/11/23 03:03:19 dtucker Exp $

View File

@ -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)) #if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
struct msghdr msg; struct msghdr msg;
struct iovec vec;
char ch = '\0';
ssize_t n;
#ifndef HAVE_ACCRIGHTS_IN_MSGHDR #ifndef HAVE_ACCRIGHTS_IN_MSGHDR
union { union {
struct cmsghdr hdr; struct cmsghdr hdr;
char tmp[CMSG_SPACE(sizeof(int))];
char buf[CMSG_SPACE(sizeof(int))]; char buf[CMSG_SPACE(sizeof(int))];
} cmsgbuf; } cmsgbuf;
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
#endif #endif
struct iovec vec;
char ch = '\0';
ssize_t n;
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
#ifdef HAVE_ACCRIGHTS_IN_MSGHDR #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)) #if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
struct msghdr msg; struct msghdr msg;
struct iovec vec;
ssize_t n;
char ch;
int fd;
#ifndef HAVE_ACCRIGHTS_IN_MSGHDR #ifndef HAVE_ACCRIGHTS_IN_MSGHDR
union { union {
struct cmsghdr hdr; struct cmsghdr hdr;
@ -110,6 +105,10 @@ mm_receive_fd(int sock)
} cmsgbuf; } cmsgbuf;
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
#endif #endif
struct iovec vec;
ssize_t n;
char ch;
int fd;
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
vec.iov_base = &ch; vec.iov_base = &ch;
@ -128,6 +127,7 @@ mm_receive_fd(int sock)
error("%s: recvmsg: %s", __func__, strerror(errno)); error("%s: recvmsg: %s", __func__, strerror(errno));
return -1; return -1;
} }
if (n != 1) { if (n != 1) {
error("%s: recvmsg: expected received 1 got %ld", error("%s: recvmsg: expected received 1 got %ld",
__func__, (long)n); __func__, (long)n);
@ -145,6 +145,7 @@ mm_receive_fd(int sock)
error("%s: no message header", __func__); error("%s: no message header", __func__);
return -1; return -1;
} }
#ifndef BROKEN_CMSG_TYPE #ifndef BROKEN_CMSG_TYPE
if (cmsg->cmsg_type != SCM_RIGHTS) { if (cmsg->cmsg_type != SCM_RIGHTS) {
error("%s: expected type %d got %d", __func__, error("%s: expected type %d got %d", __func__,