From 28bbb0c458c1f6cee5c3de1cec1f9dfea14d7196 Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Mon, 27 May 2002 17:37:32 -0700 Subject: [PATCH] [configure.ac.orig monitor_fdpass.c] Enahnce msghdr tests to address build problem on Irix reported by Dave Love . Back out last monitor_fdpass.c changes that are no longer needed with new tests. Patch tested on Irix by Jan-Frode Myklebust --- ChangeLog | 8 +++++++- configure.ac | 25 ++++++++++++++++++++----- monitor_fdpass.c | 12 +++++------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 66b55b2ce..a9a39e057 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +20020527 + - (tim) [configure.ac.orig monitor_fdpass.c] Enahnce msghdr tests to address + build problem on Irix reported by Dave Love . Back out + last monitor_fdpass.c changes that are no longer needed with new tests. + Patch tested on Irix by Jan-Frode Myklebust + 20020522 - (djm) Fix spelling mistakes, spotted by Solar Designer i @@ -671,4 +677,4 @@ - (stevesk) entropy.c: typo in debug message - (djm) ssh-keygen -i needs seeded RNG; report from markus@ -$Id: ChangeLog,v 1.2141 2002/05/22 04:24:01 djm Exp $ +$Id: ChangeLog,v 1.2142 2002/05/28 00:37:32 tim Exp $ diff --git a/configure.ac b/configure.ac index df78b789d..628adb392 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.63 2002/05/22 01:02:15 djm Exp $ +# $Id: configure.ac,v 1.64 2002/05/28 00:37:33 tim Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -1499,15 +1499,23 @@ if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD) fi +dnl make sure we're using the real structure members and not defines AC_CACHE_CHECK([for msg_accrights field in struct msghdr], ac_cv_have_accrights_in_msghdr, [ - AC_TRY_COMPILE( + AC_TRY_RUN( [ #include #include #include +int main() { +#ifdef msg_accrights +exit(1); +#endif +struct msghdr m; +m.msg_accrights = 0; +exit(0); +} ], - [ struct msghdr m; m.msg_accrights = 0; ], [ ac_cv_have_accrights_in_msghdr="yes" ], [ ac_cv_have_accrights_in_msghdr="no" ] ) @@ -1518,13 +1526,20 @@ fi AC_CACHE_CHECK([for msg_control field in struct msghdr], ac_cv_have_control_in_msghdr, [ - AC_TRY_COMPILE( + AC_TRY_RUN( [ #include #include #include +int main() { +#ifdef msg_control +exit(1); +#endif +struct msghdr m; +m.msg_control = 0; +exit(0); +} ], - [ struct msghdr m; m.msg_control = 0; ], [ ac_cv_have_control_in_msghdr="yes" ], [ ac_cv_have_control_in_msghdr="no" ] ) diff --git a/monitor_fdpass.c b/monitor_fdpass.c index fb97171ff..5401ea466 100644 --- a/monitor_fdpass.c +++ b/monitor_fdpass.c @@ -39,14 +39,13 @@ mm_send_fd(int socket, int fd) struct iovec vec; char ch = '\0'; int n; -#if !defined(HAVE_ACCRIGHTS_IN_MSGHDR) || \ - (defined(HAVE_ACCRIGHTS_IN_MSGHDR) && defined(HAVE_CONTROL_IN_MSGHDR)) +#ifndef HAVE_ACCRIGHTS_IN_MSGHDR char tmp[CMSG_SPACE(sizeof(int))]; struct cmsghdr *cmsg; #endif memset(&msg, 0, sizeof(msg)); -#if defined(HAVE_ACCRIGHTS_IN_MSGHDR) && !defined(HAVE_CONTROL_IN_MSGHDR) +#ifdef HAVE_ACCRIGHTS_IN_MSGHDR msg.msg_accrights = (caddr_t)&fd; msg.msg_accrightslen = sizeof(fd); #else @@ -84,8 +83,7 @@ mm_receive_fd(int socket) struct iovec vec; char ch; int fd, n; -#if !defined(HAVE_ACCRIGHTS_IN_MSGHDR) || \ - (defined(HAVE_ACCRIGHTS_IN_MSGHDR) && defined(HAVE_CONTROL_IN_MSGHDR)) +#ifndef HAVE_ACCRIGHTS_IN_MSGHDR char tmp[CMSG_SPACE(sizeof(int))]; struct cmsghdr *cmsg; #endif @@ -95,7 +93,7 @@ mm_receive_fd(int socket) vec.iov_len = 1; msg.msg_iov = &vec; msg.msg_iovlen = 1; -#if defined(HAVE_ACCRIGHTS_IN_MSGHDR) && !defined(HAVE_CONTROL_IN_MSGHDR) +#ifdef HAVE_ACCRIGHTS_IN_MSGHDR msg.msg_accrights = (caddr_t)&fd; msg.msg_accrightslen = sizeof(fd); #else @@ -109,7 +107,7 @@ mm_receive_fd(int socket) fatal("%s: recvmsg: expected received 1 got %d", __FUNCTION__, n); -#if defined(HAVE_ACCRIGHTS_IN_MSGHDR) && !defined(HAVE_CONTROL_IN_MSGHDR) +#ifdef HAVE_ACCRIGHTS_IN_MSGHDR if (msg.msg_accrightslen != sizeof(fd)) fatal("%s: no fd", __FUNCTION__); #else