mirror of
https://github.com/curl/curl.git
synced 2026-08-26 02:43:31 +03:00
tests/server: fix to check against winsock2 error codes on Windows
Windows's winsock2 returns socket errors via `WSAGetLastError()` and
not via `errno` like most systems out there. This was covered by
switching to the `SOCKERRNO` curl macro earlier. But, on Windows the
returned socket error codes have different values than the standard
POSIX errno values. Existing code was using the POSIX values for all
these checks. Meaning they never actually matched on Windows.
This patch defines a set of `SOCKERRNO` constants that map to the
correct socket error values for Windows and other platforms.
The reverse issue exists in core curl code, which redefines POSIX errno
values to winsock2 ones, breaking non-socket uses on Windows.
Cherry-picked from #15000
Follow-up to adcfd4fb3e #16553
Bug: https://github.com/curl/curl/pull/16553#issuecomment-2704679377
Closes #16612
This commit is contained in:
parent
25f8486f26
commit
abf80aae38
6 changed files with 32 additions and 28 deletions
|
|
@ -26,17 +26,21 @@
|
|||
#include "server_setup.h"
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
/* errno.h values */
|
||||
#undef EINTR
|
||||
#define EINTR 4
|
||||
#undef EAGAIN
|
||||
#define EAGAIN 11
|
||||
#undef ENOMEM
|
||||
#define ENOMEM 12
|
||||
#undef EINVAL
|
||||
#define EINVAL 22
|
||||
#undef ERANGE
|
||||
#define ERANGE 34
|
||||
#define SOCKEADDRINUSE WSAEADDRINUSE
|
||||
#define SOCKECONNREFUSED WSAECONNREFUSED
|
||||
#define SOCKEINPROGRESS WSAEINPROGRESS
|
||||
#define SOCKEINTR WSAEINTR
|
||||
#define SOCKEINVAL WSAEINVAL
|
||||
#define SOCKEISCONN WSAEISCONN
|
||||
#define SOCKEWOULDBLOCK WSAEWOULDBLOCK
|
||||
#else
|
||||
#define SOCKEADDRINUSE EADDRINUSE
|
||||
#define SOCKECONNREFUSED ECONNREFUSED
|
||||
#define SOCKEINPROGRESS EINPROGRESS
|
||||
#define SOCKEINTR EINTR
|
||||
#define SOCKEINVAL EINVAL
|
||||
#define SOCKEISCONN EISCONN
|
||||
#define SOCKEWOULDBLOCK EWOULDBLOCK
|
||||
#endif
|
||||
|
||||
enum {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue