mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-20 13:03:50 +00:00
MinGW: Override gai_strerror
This commit is contained in:
@@ -109,6 +109,20 @@ ss_error(const char *s)
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
ss_gai_strerror(int ecode)
|
||||
{
|
||||
static TCHAR buff[GAI_STRERROR_BUFFER_SIZE + 1];
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_MAX_WIDTH_MASK,
|
||||
NULL, ecode,
|
||||
MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
|
||||
(LPTSTR)buff, GAI_STRERROR_BUFFER_SIZE, NULL);
|
||||
return (char *)buff;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
get_conattr(HANDLE console, WORD *out_attr)
|
||||
{
|
||||
|
||||
@@ -98,6 +98,12 @@
|
||||
#endif
|
||||
#define ERROR(s) ss_error(s)
|
||||
|
||||
#ifdef gai_strerror
|
||||
#undef gai_strerror
|
||||
#endif
|
||||
#define gai_strerror(e) ss_gai_strerror(e)
|
||||
char *ss_gai_strerror(int ecode);
|
||||
|
||||
// Missing Unix functions
|
||||
#define sleep(x) Sleep((x) * 1000)
|
||||
#define bzero(s,n) memset(s,0,n)
|
||||
|
||||
Reference in New Issue
Block a user