Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libevent/dist connect(2) returns EINPROGRESS fo...



details:   https://anonhg.NetBSD.org/src/rev/301b47d58018
branches:  trunk
changeset: 786057:301b47d58018
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 12 19:41:45 2013 +0000

description:
connect(2) returns EINPROGRESS for "239.10.20.30" which is supposed to
be an unroutable address. getsockopt() to find the actual error returns
0. This is prolly broken, but this temporary work-around fixes the regression
test.

diffstat:

 external/bsd/libevent/dist/evutil.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 5046f4c4d000 -r 301b47d58018 external/bsd/libevent/dist/evutil.c
--- a/external/bsd/libevent/dist/evutil.c       Fri Apr 12 18:14:22 2013 +0000
+++ b/external/bsd/libevent/dist/evutil.c       Fri Apr 12 19:41:45 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: evutil.c,v 1.2 2013/04/11 16:56:41 christos Exp $      */
+/*     $NetBSD: evutil.c,v 1.3 2013/04/12 19:41:45 christos Exp $      */
 /*
  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
  *
@@ -27,7 +27,7 @@
 
 #include "event2/event-config.h"
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: evutil.c,v 1.2 2013/04/11 16:56:41 christos Exp $");
+__RCSID("$NetBSD: evutil.c,v 1.3 2013/04/12 19:41:45 christos Exp $");
 
 #define _GNU_SOURCE
 
@@ -483,6 +483,15 @@
 
        if (connect(*fd_ptr, sa, socklen) < 0) {
                int e = evutil_socket_geterror(*fd_ptr);
+#ifdef __NetBSD__
+               if (e == EINPROGRESS) {
+                       socklen_t l = sizeof(e);
+                       l = sizeof(e);
+                       if (getsockopt(*fd_ptr, SOL_SOCKET, SO_ERROR,
+                           (void*)&e, &l) == -1)
+                               abort();
+               }
+#endif
                if (EVUTIL_ERR_CONNECT_RETRIABLE(e))
                        return 0;
                if (EVUTIL_ERR_CONNECT_REFUSED(e))



Home | Main Index | Thread Index | Old Index