roken: fix net_write if _WIN32 and !SOCKET_IS_NOT_AN_FD

12826c9586
("Handle partial writes on non-blocking sockets") introduced
unconditional use of 'use_write' which is only declared if
defined(SOCKET_IS_NOT_AN_FD).

Change-Id: I0c43ed44a86b4f245acba849afabeb9ce739d0e5
This commit is contained in:
Jeffrey Altman
2022-01-14 12:35:50 -05:00
parent 4caaa7ca0b
commit 05781f22ab

View File

@@ -71,7 +71,7 @@ net_write (rk_socket_t fd, const void *buf, size_t nbytes)
return nbytes; return nbytes;
} }
#else #else /* defined(_WIN32) */
ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL
net_write(rk_socket_t sock, const void *buf, size_t nbytes) net_write(rk_socket_t sock, const void *buf, size_t nbytes)
@@ -102,6 +102,7 @@ net_write(rk_socket_t sock, const void *buf, size_t nbytes)
count = send (sock, cbuf, rem, 0); count = send (sock, cbuf, rem, 0);
#endif #endif
if (count < 0) { if (count < 0) {
#ifdef SOCKET_IS_NOT_AN_FD
if (!use_write) { if (!use_write) {
switch (rk_SOCK_ERRNO) { switch (rk_SOCK_ERRNO) {
case WSAEINTR: case WSAEINTR:
@@ -111,7 +112,9 @@ net_write(rk_socket_t sock, const void *buf, size_t nbytes)
default: default:
return count; return count;
} }
} else { } else
#endif
{
switch (errno) { switch (errno) {
case EINTR: case EINTR:
continue; continue;