Commit a31ddd36 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Now configure checks for struct sockaddr_storage and the ftp code tries

to survive without it if not found. AIX 4.3 targetted adjustment.
parent ed9e10f2
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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.
+5 −2
Original line number Diff line number Diff line
@@ -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;