]> granicus.if.org Git - curl/commitdiff
Now configure checks for struct sockaddr_storage and the ftp code tries
authorDaniel Stenberg <daniel@haxx.se>
Mon, 2 May 2005 11:56:15 +0000 (11:56 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 2 May 2005 11:56:15 +0000 (11:56 +0000)
to survive without it if not found. AIX 4.3 targetted adjustment.

acinclude.m4
configure.ac
lib/ftp.c

index 73e8348e26c63b817d6c7342cb67b2fbe108c7fb..f086a37ee939cab817e2ce8b33e6a2eeec29c2e5 100644 (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
index f65f8fb20865eb8e47b978b5c4de79ef02975bca..dcb8067fbc10f964dd2fb9a920a4dc5acbaffd59 100644 (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.
index a01c3d8e7196c8b9fd512742f8cfbe71f367a85d..70be8692ba0ad3b8a14039cdacab9bb32a4d236b 100644 (file)
--- 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;