Permalink
Browse files

Fixed errno processing for connect() on Windows.

  • Loading branch information...
1 parent 2521374 commit 456c0b147a1bdf2d23d7b505e7e085fc280101c7 @warped-rudi warped-rudi committed with Jun 14, 2012
Showing with 5 additions and 9 deletions.
  1. +2 −7 lib/socket.c
  2. +3 −2 win32/win32_errnowrapper.h
View
9 lib/socket.c
@@ -411,13 +411,8 @@ static int rpc_connect_sockaddr_async(struct rpc_context *rpc, struct sockaddr_s
set_nonblocking(rpc->fd);
-#if defined(WIN32)
- if (connect(rpc->fd, (struct sockaddr *)s, socksize) == 0 && errno != EINPROGRESS )
-#else
- if (connect(rpc->fd, (struct sockaddr *)s, socksize) != 0 && errno != EINPROGRESS)
-#endif
- {
- rpc_set_error(rpc, "connect() to server failed. %s(%d)", strerror(errno), errno);
+ if (connect(rpc->fd, (struct sockaddr *)s, socksize) != 0 && errno != EINPROGRESS) {
+ rpc_set_error(rpc, "connect() to server failed. %s(%d)", strerror(errno), errno);
return -1;
}
View
5 win32/win32_errnowrapper.h
@@ -9,7 +9,8 @@
#undef EINPROGRESS
#define EWOULDBLOCK WSAEWOULDBLOCK
-#define EAGAIN WSAEWOULDBLOCK //same on windows
+#define EAGAIN WSAEWOULDBLOCK //same on windows
#define EINTR WSAEINTR
-#define EINPROGRESS WSAEINPROGRESS
+#define EINPROGRESS WSAEWOULDBLOCK //does not map to WSAEINPROGRESS !
+
#endif //WIN32_ERRNOWRAPPER_H_

0 comments on commit 456c0b1

Please sign in to comment.