1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-08 22:08:02 +00:00

Check for when errno is set on windows as well as the windows variant for errors.

This commit is contained in:
Con Kolivas 2014-02-06 14:00:58 +11:00 committed by Noel Maersk
parent 88c7720caf
commit f8b9e41f28

8
util.h
View File

@ -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