summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--win32/win32.c11
2 files changed, 10 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 729670c27dc..d9436deb716 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Aug 3 16:28:09 2009 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * 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 <nobu@ruby-lang.org>
* array.c (permute0): use chars for boolean array.
diff --git a/win32/win32.c b/win32/win32.c
index b98575572b6..8f2a4ac8fad 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;