Check for when errno is set on windows as well as the windows variant for errors.
diff --git a/util.h b/util.h
index c4d21ca..566f3a7 100644
--- a/util.h
+++ b/util.h
@@ -41,17 +41,19 @@
extern char *WSAErrorMsg(void);
#define SOCKERRMSG WSAErrorMsg()
+ /* Check for windows variants of the errors as well as when ming
+ * decides to wrap the error into the errno equivalent. */
static inline bool sock_blocks(void)
{
- return (WSAGetLastError() == WSAEWOULDBLOCK);
+ return (WSAGetLastError() == WSAEWOULDBLOCK || errno == EAGAIN);
}
static inline bool sock_timeout(void)
{
- return (WSAGetLastError() == WSAETIMEDOUT);
+ return (WSAGetLastError() == WSAETIMEDOUT || errno == ETIMEDOUT);
}
static inline bool interrupted(void)
{
- return (WSAGetLastError() == WSAEINTR);
+ return (WSAGetLastError() == WSAEINTR || errno == EINTR);
}
#ifndef SHUT_RDWR
#define SHUT_RDWR SD_BOTH