[patch] Correct configure test for sin_len to compile on Tru64 Unix

Wayne Davison wayned at samba.org
Thu Feb 26 04:22:47 GMT 2004


On Wed, Feb 25, 2004 at 07:32:52PM -0800, Wayne Davison wrote:
> So, it looks like we need 2 configure tests and separate defines for
> sa_len and sin_len.

How about the appended patch?  This applies to the very latest CVS
source and would require the running of "autoconf" and "autoheader"
after applying it.

..wayne..
-------------- next part --------------
--- clientname.c	11 Jan 2003 02:05:56 -0000	1.15
+++ clientname.c	26 Feb 2004 03:51:43 -0000
@@ -195,7 +195,7 @@ void client_sockaddr(int fd,
 		memset(sin, 0, sizeof(*sin));
 		sin->sin_family = AF_INET;
 		*ss_len = sizeof(struct sockaddr_in);
-#ifdef HAVE_SOCKADDR_LEN
+#ifdef HAVE_SOCKADDR_SIN_LEN
 		sin->sin_len = *ss_len;
 #endif
 		sin->sin_port = sin6.sin6_port;
--- configure.in	26 Feb 2004 04:03:35 -0000	1.185
+++ configure.in	26 Feb 2004 04:04:54 -0000
@@ -388,9 +388,16 @@ else
 	AC_LIBOBJ(lib/getnameinfo)
 fi
 
-
 AC_CHECK_MEMBER([struct sockaddr.sa_len],
-		[ AC_DEFINE(HAVE_SOCKADDR_LEN, 1, [Do we have sockaddr.sa_len?]) ],
+		[ AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Do we have sockaddr.sa_len?]) ],
+		[],
+		[
+#include <sys/types.h>
+#include <sys/socket.h>
+])
+
+AC_CHECK_MEMBER([struct sockaddr.sin_len],
+		[ AC_DEFINE(HAVE_SOCKADDR_SIN_LEN, 1, [Do we have sockaddr.sin_len?]) ],
 		[],
 		[
 #include <sys/types.h>
--- socket.c	20 Jan 2004 04:57:15 -0000	1.92
+++ socket.c	26 Feb 2004 03:53:00 -0000
@@ -698,7 +698,7 @@ static int socketpair_tcp(int fd[2])
 		goto failed;
 
 	memset(&sock2, 0, sizeof sock2);
-#ifdef HAVE_SOCKADDR_LEN
+#ifdef HAVE_SOCKADDR_SIN_LEN
 	sock2.sin_len = sizeof sock2;
 #endif
 	sock2.sin_family = PF_INET;
--- lib/addrinfo.h	5 Dec 2001 13:19:16 -0000	1.8
+++ lib/addrinfo.h	26 Feb 2004 03:52:26 -0000
@@ -111,7 +111,7 @@ extern char *gai_strerror(int);
 
 #ifndef HAVE_SOCKADDR_STORAGE
 struct sockaddr_storage {
-#ifdef HAVE_SOCKADDR_LEN
+#ifdef HAVE_SOCKADDR_SA_LEN
 	uchar		ss_len;		/* address length */
 	uchar		ss_family;	/* address family */
 #else
--- lib/getaddrinfo.c	10 Jan 2003 22:38:25 -0000	1.17
+++ lib/getaddrinfo.c	26 Feb 2004 03:52:36 -0000
@@ -161,7 +161,7 @@ static int get_ai(struct addrinfo ** to_
 	(*to_ai)->ai_addr = (struct sockaddr *)((*to_ai) + 1);
 	memset((*to_ai)->ai_addr, 0, (afd)->a_socklen);
 	(*to_ai)->ai_addrlen = (afd)->a_socklen;
-#if HAVE_SOCKADDR_LEN
+#if HAVE_SOCKADDR_SA_LEN
 	(*to_ai)->ai_addr->sa_len= (afd)->a_socklen;
 #endif
 	(*to_ai)->ai_addr->sa_family = (*to_ai)->ai_family = (afd)->a_af;
--- lib/getnameinfo.c	10 Jan 2003 22:38:25 -0000	1.11
+++ lib/getnameinfo.c	26 Feb 2004 03:52:48 -0000
@@ -99,9 +99,9 @@ getnameinfo(sa, salen, host, hostlen, se
 	if (sa == NULL)
 		return ENI_NOSOCKET;
 
-#ifdef HAVE_SOCKADDR_LEN
+#ifdef HAVE_SOCKADDR_SA_LEN
 	if (sa->sa_len != salen) return ENI_SALEN;
-#endif /* HAVE_SOCKADDR_LEN */
+#endif
 	
 	family = sa->sa_family;
 	for (i = 0; afdl[i].a_af; i++)


More information about the rsync mailing list