Windows: an error set where socket errors are read

errno is WSAGetLastError() on Windows, but seterrno3() set the C
library's errno there: the EAGAIN of a TLS read or write wanting the
socket again was not seen as one, and the error left was whatever the
socket call before had set. seterrno3() sets the socket error now.

socks.c assigned errno directly, which does not build on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir Dubrovin 2026-10-27 14:40:42 +03:00
parent 63cfcafbc5
commit b7037f1159
2 changed files with 3 additions and 2 deletions

View File

@ -182,7 +182,8 @@ size_t threadstacksize(int extra);
#ifndef strncasecmp #ifndef strncasecmp
#define strncasecmp strnicmp #define strncasecmp strnicmp
#endif #endif
#define seterrno3(x) _set_errno(x) /* errno is WSAGetLastError() here */
#define seterrno3(x) WSASetLastError(x)
#else #else
#define seterrno3(x) (errno = x) #define seterrno3(x) (errno = x)
#endif #endif

View File

@ -381,7 +381,7 @@ fflush(stderr);
break; break;
} }
if (!fds[0].revents) { if (!fds[0].revents) {
errno = EAGAIN; seterrno3(EAGAIN);
continue; continue;
} }
sasize = sizeof(param->sinsr); sasize = sizeof(param->sinsr);