From fe038100d98e5352139367627809c17f1773f9c9 Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 3 Aug 2009 07:30:19 +0000 Subject: [PATCH] * win32/win32.c (rb_w32_connect): return value was broken when some error occurred. [ruby-core:24234] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ win32/win32.c | 11 ++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 729670c27d..d9436deb71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Aug 3 16:28:09 2009 NAKAMURA Usaku + + * win32/win32.c (rb_w32_connect): return value was broken when some + error occurred. + [ruby-core:24234] + Mon Aug 3 15:56:52 2009 Nobuyoshi Nakada * array.c (permute0): use chars for boolean array. diff --git a/win32/win32.c b/win32/win32.c index b98575572b..8f2a4ac8fa 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2591,14 +2591,11 @@ rb_w32_connect(int s, const struct sockaddr *addr, int addrlen) RUBY_CRITICAL({ r = connect(TO_SOCKET(s), addr, addrlen); if (r == SOCKET_ERROR) { - r = WSAGetLastError(); - if (r != WSAEWOULDBLOCK) { - errno = map_errno(r); - } - else { + int err = WSAGetLastError(); + if (err != WSAEWOULDBLOCK) + errno = map_errno(err); + else errno = EINPROGRESS; - r = -1; - } } }); return r;