1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

On Windows safe_read or safe_write return -1 and set errno = EWOULDBLOCK

for nonblocking io.
This commit is contained in:
witekfl 2012-05-25 19:43:10 +02:00
parent a140e1d79f
commit 2ec6c54697

View File

@ -716,7 +716,13 @@ generic_write(struct socket *socket, unsigned char *data, int len)
if (!wr) return SOCKET_CANT_WRITE;
return wr < 0 ? SOCKET_SYSCALL_ERROR : wr;
if (wr < 0) {
#ifdef EWOULDBLOCK
if (errno == EWOULDBLOCK) return SOCKET_CANT_WRITE;
#endif
return SOCKET_SYSCALL_ERROR;
}
return wr;
}
static void
@ -846,7 +852,13 @@ generic_read(struct socket *socket, unsigned char *data, int len)
if (!rd) return SOCKET_CANT_READ;
return rd < 0 ? SOCKET_SYSCALL_ERROR : rd;
if (rd < 0) {
#ifdef EWOULDBLOCK
if (errno == EWOULDBLOCK) return SOCKET_CANT_READ;
#endif
return SOCKET_SYSCALL_ERROR;
}
return rd;
}
static void