Permalink
Browse files

Fixed errno processing for connect() on Windows.

  • Loading branch information...
1 parent ac55960 commit f96b24fadad7dddbd4162bf8fdb2e9c9206bb2a7 @warped-rudi warped-rudi committed with warped-rudi Jun 14, 2012
Showing with 5 additions and 9 deletions.
  1. +2 −7 lib/socket.c
  2. +3 −2 win32/win32_errnowrapper.h
View
@@ -412,13 +412,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;
}
@@ -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 f96b24f

Please sign in to comment.