MinGW: Override gai_strerror

This commit is contained in:
Linus Yang
2018-03-23 04:27:50 +08:00
parent af9dc106e3
commit e02ad6b1bc
2 changed files with 20 additions and 0 deletions
+14
View File
@@ -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)
{
+6
View File
@@ -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)