diff options
Diffstat (limited to 'mail/libetpan/patches/patch-af')
-rw-r--r-- | mail/libetpan/patches/patch-af | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/mail/libetpan/patches/patch-af b/mail/libetpan/patches/patch-af new file mode 100644 index 00000000000..2eaec72d53f --- /dev/null +++ b/mail/libetpan/patches/patch-af @@ -0,0 +1,66 @@ +$NetBSD: patch-af,v 1.1 2008/01/25 18:26:32 smb Exp $ + +--- src/data-types/connect.c.orig 2007-08-06 17:32:30.000000000 -0400 ++++ src/data-types/connect.c 2008-01-25 13:15:13.000000000 -0500 +@@ -88,6 +88,21 @@ + return 0; + } + ++#ifdef HAVE_IPV6 ++static int verify_sock_errors(int s) ++{ ++ uint len; ++ int val; ++ len = sizeof(val); ++ if (getsockopt(s, SOL_SOCKET, SO_ERROR, &val, &len) < 0) { ++ return -1; ++ } else if (val != 0) { ++ return -1; ++ } ++ return 0; ++} ++#endif ++ + static int wait_connect(int s, int r) + { + fd_set fds; +@@ -206,6 +221,7 @@ + + for (ai = res; ai != NULL; ai = ai->ai_next) { + s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); ++ + if (s == -1) + continue; + +@@ -239,9 +255,23 @@ + + r = connect(s, ai->ai_addr, ai->ai_addrlen); + r = wait_connect(s, r); ++ ++ if (r != -1) { ++ r = verify_sock_errors(s); ++ } ++ + if (r == -1) { ++ if (ai->ai_next) { ++#ifdef WIN32 ++ closesocket(s); ++#else ++ close(s); ++#endif ++ continue; ++ } else { + goto close_socket; + } ++ } + /* if we're here, we're good */ + break; + } +@@ -252,7 +282,6 @@ + if (ai == NULL) + goto err; + #endif +- + return s; + + close_socket: |