From 159823e200e763529b0885715c0624559aacf82a Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Sun, 28 Jan 2001 02:16:20 +0000 Subject: [PATCH] Added support for the CYGWIN gcc compiler. --- src/luasocket.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/luasocket.c b/src/luasocket.c index b81bca7..644edd6 100644 --- a/src/luasocket.c +++ b/src/luasocket.c @@ -1205,7 +1205,7 @@ static void tm_markstart(p_sock sock) \*-------------------------------------------------------------------------*/ static int tm_gettime(void) { -#ifdef _WIN32 +#ifdef WIN32 return GetTickCount(); #else struct tms t; @@ -1290,13 +1290,19 @@ static int send_raw(p_sock sock, const char *data, int wanted, int *total) /* a bug in WinSock forces us to do a busy wait until we manage ** to write, because select returns immediately even though it ** should have blocked us until we could write... */ - if (WSAGetLastError() == WSAEWOULDBLOCK) + if (put < 0 && WSAGetLastError() == WSAEWOULDBLOCK) continue; #endif +#ifdef __CYGWIN__ + /* this is for CYGWIN, which is like Unix but with Win32 Bugs */ + if (put < 0 && errno == EWOULDBLOCK) + continue; +#endif + return NET_CLOSED; } wanted -= put; - data += put; + data += put; *total += put; } return NET_DONE;