summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c11
1 files changed, 4 insertions, 7 deletions
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;