From 05781f22abfa06286dafb8546260fb2bebcb77c2 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 14 Jan 2022 12:35:50 -0500 Subject: [PATCH] roken: fix net_write if _WIN32 and !SOCKET_IS_NOT_AN_FD 12826c9586f19b63198879c4bb93eb6395d0bfe1 ("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 --- lib/roken/net_write.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/roken/net_write.c b/lib/roken/net_write.c index 1e8361999..e66f56b75 100644 --- a/lib/roken/net_write.c +++ b/lib/roken/net_write.c @@ -71,7 +71,7 @@ net_write (rk_socket_t fd, const void *buf, size_t nbytes) return nbytes; } -#else +#else /* defined(_WIN32) */ ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL 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); #endif if (count < 0) { +#ifdef SOCKET_IS_NOT_AN_FD if (!use_write) { switch (rk_SOCK_ERRNO) { case WSAEINTR: @@ -111,7 +112,9 @@ net_write(rk_socket_t sock, const void *buf, size_t nbytes) default: return count; } - } else { + } else +#endif + { switch (errno) { case EINTR: continue;