Now configure checks for struct sockaddr_storage and the ftp code tries

to survive without it if not found. AIX 4.3 targetted adjustment.
This commit is contained in:
Daniel Stenberg 2005-05-02 11:56:15 +00:00
parent ed9e10f2d8
commit a31ddd363b
3 changed files with 31 additions and 2 deletions

View File

@ -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 <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#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

View File

@ -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.

View File

@ -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;