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)
committerwarped-rudi <r.ihle@s-t.de>
Tue, 18 Sep 2012 06:33:41 +0000 (08:33 +0200)
lib/socket.c
win32/win32_errnowrapper.h

index c746c76affeb2efe123aa3ec752040eec281be34..1bb34f0ef9e57212d7919d4fee3d0d524c3488f6 100644 (file)
@@ -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;
        }               
 
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_