From: unknown Date: Fri, 2 Sep 2011 22:58:31 +0000 (+0200) Subject: [fix] - fix connect for win32 - return values are inverted X-Git-Tag: upstream/1.9.6^2~310 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4b0e8df9a9c5cf23c93de12f2c59d33dda9f3a9d;p=deb_libnfs.git [fix] - fix connect for win32 - return values are inverted --- diff --git a/lib/socket.c b/lib/socket.c index efe8739..760da2f 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -373,8 +373,12 @@ int rpc_connect_async(struct rpc_context *rpc, const char *server, int port, rpc rpc->connect_data = private_data; set_nonblocking(rpc->fd); - - if (connect(rpc->fd, (struct sockaddr *)&s, socksize) != 0 && errno != EINPROGRESS) { +#if defined(WIN32) + if (connect(rpc->fd, (struct sockaddr *)&s, socksize) == 0 && GetLastError() != WSAEINPROGRESS ) +#else + if (connect(rpc->fd, (struct sockaddr *)&s, socksize) != 0 && errno != EINPROGRESS) +#endif + { rpc_set_error(rpc, "connect() to server failed"); return -1; }