Browse Source

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

Conflicts:
	util.h
Con Kolivas 12 years ago
parent
commit
32dd5266aa
1 changed files with 4 additions and 2 deletions
  1. 4 2
      util.h

+ 4 - 2
util.h

@@ -60,13 +60,15 @@
 	#define SOCKERR (WSAGetLastError())
 	#define SOCKERRMSG bfg_strerror(WSAGetLastError(), BST_SOCKET)
 
+	/* 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 interrupted(void)
 	{
-		return (WSAGetLastError() == WSAEINTR);
+		return (WSAGetLastError() == WSAEINTR || errno == EINTR);
 	}
 	#ifndef SHUT_RDWR
 	#define SHUT_RDWR SD_BOTH