Fix non-Windows build.

This commit is contained in:
Alexei Svitkine 2015-08-09 18:31:30 -04:00
parent 7e111f6fc5
commit a06cbd6784

View File

@ -14,6 +14,12 @@
#include <sys/filio.h> #include <sys/filio.h>
#endif #endif
#ifdef _WIN32
#define IS_EAGAIN(e) ((e) == WSAEINTR || (e) == EAGAIN)
#else
#define IS_EAGAIN(e) ((e) == EAGAIN)
#endif
void void
so_init() so_init()
{ {
@ -161,7 +167,7 @@ soread(so)
#endif #endif
if (nn <= 0) { if (nn <= 0) {
int error = WSAGetLastError(); int error = WSAGetLastError();
if (nn < 0 && (error == WSAEINTR || error == EAGAIN)) if (nn < 0 && IS_EAGAIN(error))
return 0; return 0;
else { else {
DEBUG_MISC((dfd, " --- soread() disconnected, nn = %d, errno = %d-%s\n", nn, errno,strerror(errno))); DEBUG_MISC((dfd, " --- soread() disconnected, nn = %d, errno = %d-%s\n", nn, errno,strerror(errno)));
@ -348,7 +354,7 @@ sowrite(so)
/* This should never happen, but people tell me it does *shrug* */ /* This should never happen, but people tell me it does *shrug* */
if (nn < 0) { if (nn < 0) {
int error = WSAGetLastError(); int error = WSAGetLastError();
if (error == EAGAIN || error == WSAEINTR) if (IS_EAGAIN(error))
return 0; return 0;
} }