You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2007/10/15 01:44:47 UTC

svn commit: r584640 - /apr/apr/branches/1.2.x/test/testsockets.c

Author: wrowe
Date: Sun Oct 14 16:44:46 2007
New Revision: 584640

URL: http://svn.apache.org/viewvc?rev=584640&view=rev
Log:
Fix testsockets the crufty way, backporting the silly 
omission of APR_STATUS_IS_EAFNOSUPPORT.

Modified:
    apr/apr/branches/1.2.x/test/testsockets.c

Modified: apr/apr/branches/1.2.x/test/testsockets.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/test/testsockets.c?rev=584640&r1=584639&r2=584640&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testsockets.c (original)
+++ apr/apr/branches/1.2.x/test/testsockets.c Sun Oct 14 16:44:46 2007
@@ -59,10 +59,16 @@
 /* On recent Linux systems, whilst IPv6 is always supported by glibc,
  * socket(AF_INET6, ...) calls will fail with EAFNOSUPPORT if the
  * "ipv6" kernel module is not loaded.  */
-#ifdef EAFNOSUPPORT
+#if defined(WSAEAFNOSUPPORT)
+#define V6_NOT_ENABLED(e) ((e) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT)
+#elif defined(SOCEAFNOSUPPORT)
+#define V6_NOT_ENABLED(e) ((e) == APR_OS_START_SYSERR + SOCEAFNOSUPPORT)
+#elif defined(EAFNOSUPPORT)
 #define V6_NOT_ENABLED(e) ((e) == EAFNOSUPPORT)
+#elif !APR_HAVE_IPV6
+#define V6_NOT_ENABLED(e) (1)
 #else
-#define V6_NOT_ENABLED(e) (0)
+#error MUST have an EAFNOSUPPORT class of error code to enable IPv6!
 #endif
 
 static void tcp6_socket(abts_case *tc, void *data)
@@ -118,6 +124,10 @@
     apr_size_t len = 30;
 
     rv = apr_socket_create(&sock, family, SOCK_DGRAM, 0, p);
+    if ((family == APR_INET6) && V6_NOT_ENABLED(rv)) {
+        ABTS_NOT_IMPL(tc, "IPv6 not enabled");
+        return;
+    }
     ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
     if (rv != APR_SUCCESS)
         return;