Cygwin/Mingw32 compile fixes.

This commit is contained in:
Jan Vidar Krey 2012-01-25 00:20:59 +01:00
parent e4df1884d2
commit 5068fe8351
2 changed files with 26 additions and 3 deletions

View File

@ -156,7 +156,13 @@ ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len)
ret = net_send(con->sd, buf, len, UHUB_SEND_SIGNAL);
if (ret == -1)
{
if (net_error() == EWOULDBLOCK || net_error() == EINTR)
if (
#ifdef WINSOCK
net_error() == WSAEWOULDBLOCK
#else
net_error() == EWOULDBLOCK
#endif
|| net_error() == EINTR)
return 0;
return -1;
}
@ -190,7 +196,13 @@ ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len)
ret = net_recv(con->sd, buf, len, 0);
if (ret == -1)
{
if (net_error() == EWOULDBLOCK || net_error() == EINTR)
if (
#ifdef WINSOCK
net_error() == WSAEWOULDBLOCK
#else
net_error() == EWOULDBLOCK
#endif
|| net_error() == EINTR)
return 0;
return -net_error();
}
@ -226,7 +238,13 @@ ssize_t net_con_peek(struct net_connection* con, void* buf, size_t len)
int ret = net_recv(con->sd, buf, len, MSG_PEEK);
if (ret == -1)
{
if (net_error() == EWOULDBLOCK || net_error() == EINTR)
if (
#ifdef WINSOCK
net_error() == WSAEWOULDBLOCK
#else
net_error() == EWOULDBLOCK
#endif
|| net_error() == EINTR)
return 0;
return -net_error();
}

View File

@ -36,6 +36,11 @@
#endif
#endif
#if defined(__CYGWIN__) || defined(__MINGW32__)
#define HAVE_SSIZE_T
#define NEED_GETOPT
#endif
#ifdef WINSOCK
#ifndef FD_SETSIZE
#define FD_SETSIZE 4096