Fixed errno processing for connect() on Windows.
authorRudi Ihle <r.ihle@s-t.de>
Thu, 14 Jun 2012 07:23:25 +0000 (09:23 +0200)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Sat, 24 Nov 2012 16:12:45 +0000 (08:12 -0800)
lib/socket.c
win32/win32_errnowrapper.h

index c64bf2eb7cad0f937169eb91a43e6aa02ae1dff3..3fa8378d9102b0127ded464dd9439d47258a7a53 100644 (file)
@@ -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;
        }               
 
index 4477d3f975512bc5c776b01f932600106738abb5..ebed01c35eed8a00a8f56a14895f0bbbd7983925 100644 (file)
@@ -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_