X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Fsocket.c;h=bc101e7a6821b01b78d987bd5e8aad917ecfe126;hb=fcc42bfe8501f9f4c5b69d19f5d196e5348c4c81;hp=6e162a85b6ffc2e73ace6c0ed256230815a3ce9e;hpb=f650a138b6c21bb2a74a2254f7f288dfdd3245fa;p=deb_libnfs.git diff --git a/lib/socket.c b/lib/socket.c index 6e162a8..bc101e7 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -25,21 +25,6 @@ #include #endif/*WIN32*/ -#if defined(WIN32) -#include -#include -#include -#define ssize_t SSIZE_T -#define MSG_DONTWAIT 0 -#else -#include -#include -#include -#include -#include -#include -#endif - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -62,6 +47,12 @@ #include "libnfs-private.h" #include "slist.h" +#ifdef WIN32 +//has to be included after stdlib!! +#include "win32_errnowrapper.h" +#endif + + static int rpc_disconnect_requeue(struct rpc_context *rpc); static void set_nonblocking(int fd) @@ -267,7 +258,11 @@ static int rpc_read_from_socket(struct rpc_context *rpc) int rpc_service(struct rpc_context *rpc, int revents) { if (revents & POLLERR) { +#ifdef WIN32 char err = 0; +#else + int err = 0; +#endif socklen_t err_size = sizeof(err); if (getsockopt(rpc->fd, SOL_SOCKET, SO_ERROR, @@ -414,7 +409,7 @@ int rpc_connect_async(struct rpc_context *rpc, const char *server, int port, rpc set_nonblocking(rpc->fd); #if defined(WIN32) - if (connect(rpc->fd, (struct sockaddr *)&s, socksize) == 0 && GetLastError() != WSAEINPROGRESS ) + if (connect(rpc->fd, (struct sockaddr *)&s, socksize) == 0 && errno != EINPROGRESS ) #else if (connect(rpc->fd, (struct sockaddr *)&s, socksize) != 0 && errno != EINPROGRESS) #endif