Petter Reinholdtsen
2004-Feb-25 12:45 UTC
[patch] Correct configure test for sin_len to compile on Tru64 Unix
The last versions of rsync fail to compile on Tru64 Unix (alpha), because of a typo in configure.in. The problem is that the code in configure check for sockaddr.sa_len, while the code uses sockaddr.sin_len. This patch fixes the problem. Please include it in the next version of rsync. diff -ur src-2.6.0/configure.in src-2.6.0-local/configure.in --- src-2.6.0-local/configure.in 2004-01-01 20:09:16.000000000 +0100 +++ src-2.6.0-foo/configure.in 2004-02-25 13:43:37.000000000 +0100 @@ -367,7 +367,7 @@ fi -AC_CHECK_MEMBER([struct sockaddr.sa_len], +AC_CHECK_MEMBER([struct sockaddr.sin_len], [ AC_DEFINE(HAVE_SOCKADDR_LEN) ], [], [ Without this fix, the compile fail with this error message: cc-wrapper -I. -I. -g -DHAVE_CONFIG_H -c socket.c -o socket.o cc: Error: socket.c, line 619: In this statement, "sin_len" is not a member of "sock2". (needmember) sock2.sin_len = sizeof(sock2); --------^ make: *** [socket.o] Error 1
Wayne Davison
2004-Feb-26 03:33 UTC
[patch] Correct configure test for sin_len to compile on Tru64 Unix
On Wed, Feb 25, 2004 at 01:44:58PM +0100, Petter Reinholdtsen wrote:> The problem is that the code in configure check for sockaddr.sa_len, > while the code uses sockaddr.sin_len.The problem is deeper than that. The HAVE_SOCKADDR_LEN define surrounds both code that uses sin_len and sa_len, so your change will probably cause problems for other systems. So, it looks like we need 2 configure tests and separate defines for sa_len and sin_len. ..wayne..
Wayne Davison
2004-Feb-26 04:23 UTC
[patch] Correct configure test for sin_len to compile on Tru64 Unix
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++)
Petter Reinholdtsen
2004-Feb-26 08:02 UTC
[patch] Correct configure test for sin_len to compile on Tru64 Unix
[Wayne Davison]> The problem is deeper than that. The HAVE_SOCKADDR_LEN define surrounds > both code that uses sin_len and sa_len, so your change will probably > cause problems for other systems. So, it looks like we need 2 configure > tests and separate defines for sa_len and sin_len.Oh. I searched for sa_len and was unable to find code using it. But I only searched in the top level directory. Two different defines is probably a good idea, to avoid confusion. :)