Windows: Fix use of file descriptors as sockets
Sockets and file descriptors are not interchangeable on Windows. The test for checking whether a given value is a socket or an FD was broken for the case where WinSock was not initialized to begin with.
This commit is contained in:

committed by
Asanka C. Herath

parent
bd795255aa
commit
7e3bd7f9aa
@@ -86,7 +86,8 @@ net_read(rk_socket_t sock, void *buf, size_t nbytes)
|
||||
|
||||
if (use_read == 0 &&
|
||||
rk_IS_SOCKET_ERROR(count) &&
|
||||
rk_SOCK_ERRNO == WSAENOTSOCK) {
|
||||
(rk_SOCK_ERRNO == WSANOTINITIALISED ||
|
||||
rk_SOCK_ERRNO == WSAENOTSOCK)) {
|
||||
use_read = 1;
|
||||
|
||||
count = _read (sock, cbuf, rem);
|
||||
|
@@ -83,7 +83,8 @@ net_write(rk_socket_t sock, const void *buf, size_t nbytes)
|
||||
|
||||
if (use_write == 0 &&
|
||||
rk_IS_SOCKET_ERROR(count) &&
|
||||
rk_SOCK_ERRNO == WSAENOTSOCK) {
|
||||
(rk_SOCK_ERRNO == WSANOTINITIALISED ||
|
||||
rk_SOCK_ERRNO == WSAENOTSOCK)) {
|
||||
use_write = 1;
|
||||
|
||||
count = _write (sock, cbuf, rem);
|
||||
|
Reference in New Issue
Block a user