From a31ddd363bb125e852b57a715200b8f276c731fb Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 2 May 2005 11:56:15 +0000 Subject: [PATCH] Now configure checks for struct sockaddr_storage and the ftp code tries to survive without it if not found. AIX 4.3 targetted adjustment. --- acinclude.m4 | 24 ++++++++++++++++++++++++ configure.ac | 2 ++ lib/ftp.c | 7 +++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 73e8348e2..f086a37ee 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -122,6 +122,30 @@ dnl end of non-blocking try-compile test fi ]) +dnl Check for struct sockaddr_storage. Most IPv6-enabled hosts have it, but +dnl AIX 4.3 is one known exception. +AC_DEFUN([TYPE_SOCKADDR_STORAGE], +[ + AC_CHECK_TYPE([struct sockaddr_storage], + AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, + [if struct sockaddr_storage is defined]), , + [ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + ]) + +]) + dnl Check for socklen_t: historically on BSD it is an int, and in dnl POSIX 1g it is a type of its own, but some platforms use different dnl types for the argument to getsockopt, getpeername, etc. So we diff --git a/configure.ac b/configure.ac index f65f8fb20..dcb8067fb 100644 --- a/configure.ac +++ b/configure.ac @@ -1400,6 +1400,8 @@ AC_CHECK_TYPE(ssize_t, , TYPE_SOCKLEN_T TYPE_IN_ADDR_T +TYPE_SOCKADDR_STORAGE + AC_FUNC_SELECT_ARGTYPES dnl Checks for library functions. diff --git a/lib/ftp.c b/lib/ftp.c index a01c3d8e7..70be8692b 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -777,9 +777,12 @@ static CURLcode ftp_state_use_port(struct connectdata *conn, /****************************************************************** * IPv6-specific section */ - - struct addrinfo *res, *ai; +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE struct sockaddr_storage ss; +#else + char ss[256]; /* this should be big enough to fit a lot */ +#endif + struct addrinfo *res, *ai; socklen_t sslen; char hbuf[NI_MAXHOST]; struct sockaddr *sa=(struct sockaddr *)&ss; -- 2.50.1