apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r584660 - /apr/apr/trunk/test/testsock.c
Date Mon, 15 Oct 2007 02:57:52 GMT
Author: wrowe
Date: Sun Oct 14 19:57:52 2007
New Revision: 584660

URL: http://svn.apache.org/viewvc?rev=584660&view=rev
Log:
Without otherwise addressing the issues on Win32 when presented
with mixed-notation addresses and no IPv6 adapter present, at
least avoid crashing.

Modified:
    apr/apr/trunk/test/testsock.c

Modified: apr/apr/trunk/test/testsock.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testsock.c?rev=584660&r1=584659&r2=584660&view=diff
==============================================================================
--- apr/apr/trunk/test/testsock.c (original)
+++ apr/apr/trunk/test/testsock.c Sun Oct 14 19:57:52 2007
@@ -210,17 +210,22 @@
 static void test_print_addr(abts_case *tc, void *data)
 {
     apr_sockaddr_t *sa;
+    apr_status_t rv;
     char *s;
 
-    APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr",
-                       apr_sockaddr_info_get(&sa, "0.0.0.0", APR_INET, 80, 0, p));
+    rv = apr_sockaddr_info_get(&sa, "0.0.0.0", APR_INET, 80, 0, p);
+    APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
 
     s = apr_psprintf(p, "foo %pI bar", sa);
 
     ABTS_STR_EQUAL(tc, "foo 0.0.0.0:80 bar", s);
 
 #if APR_HAVE_IPV6
-    if (apr_sockaddr_info_get(&sa, "::ffff:0.0.0.0", APR_INET6, 80, 0, p) == APR_SUCCESS)
{
+    rv = apr_sockaddr_info_get(&sa, "::ffff:0.0.0.0", APR_INET6, 80, 0, p);
+    APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);
+    if (rv == APR_SUCCESS)
+        ABTS_TRUE(tc, sa != NULL);
+    if (rv == APR_SUCCESS && sa) {
         /* sa should now be a v4-mapped IPv6 address. */
         char buf[128];
 



Mime
View raw message