Skip to content
Snippets Groups Projects
Commit 4798e18e authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Create get_socket_errno() to replace ERROR_VALUE macro eventually

parent 80379e91
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4525 passed
...@@ -731,6 +731,16 @@ DLLEXPORT void set_socket_errno(int err) ...@@ -731,6 +731,16 @@ DLLEXPORT void set_socket_errno(int err)
#endif #endif
} }
DLLEXPORT int get_socket_errrno(void)
{
#if defined(_WINSOCKAPI_)
int wsa_error = WSAGetLastError();
return wsa_error >= WSABASEERR ? wsa_error - WSABASEERR : wsa_error;
#else
return errno;
#endif
}
DLLEXPORT int xp_inet_pton(int af, const char *src, void *dst) DLLEXPORT int xp_inet_pton(int af, const char *src, void *dst)
{ {
struct addrinfo hints = {0}; struct addrinfo hints = {0};
......
...@@ -239,6 +239,7 @@ DLLEXPORT void inet_setaddrport(union xp_sockaddr *addr, uint16_t port); ...@@ -239,6 +239,7 @@ DLLEXPORT void inet_setaddrport(union xp_sockaddr *addr, uint16_t port);
DLLEXPORT BOOL inet_addrmatch(union xp_sockaddr* addr1, union xp_sockaddr* addr2); DLLEXPORT BOOL inet_addrmatch(union xp_sockaddr* addr1, union xp_sockaddr* addr2);
DLLEXPORT char* socket_strerror(int, char*, size_t); DLLEXPORT char* socket_strerror(int, char*, size_t);
DLLEXPORT void set_socket_errno(int); DLLEXPORT void set_socket_errno(int);
DLLEXPORT int get_socket_errno(void);
DLLEXPORT int xp_inet_pton(int af, const char *src, void *dst); DLLEXPORT int xp_inet_pton(int af, const char *src, void *dst);
#if defined(_WIN32) // mingw and WinXP's WS2_32.DLL don't have inet_pton(): #if defined(_WIN32) // mingw and WinXP's WS2_32.DLL don't have inet_pton():
#define inet_pton xp_inet_pton #define inet_pton xp_inet_pton
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment