Commit 9e4b04f8 authored by Martin Storsjö's avatar Martin Storsjö

network: Always use our version of gai_strerror on windows

Even if linking directly to getaddrinfo, use our version of
gai_strerror instead of the system's version. Microsoft explicitly
documents that their version of gai_strerror is thread-unsafe.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent c98e2053
......@@ -177,10 +177,12 @@ void ff_freeaddrinfo(struct addrinfo *res);
int ff_getnameinfo(const struct sockaddr *sa, int salen,
char *host, int hostlen,
char *serv, int servlen, int flags);
const char *ff_gai_strerror(int ecode);
#define getaddrinfo ff_getaddrinfo
#define freeaddrinfo ff_freeaddrinfo
#define getnameinfo ff_getnameinfo
#endif
#if !HAVE_GETADDRINFO || HAVE_WINSOCK2_H
const char *ff_gai_strerror(int ecode);
#undef gai_strerror
#define gai_strerror ff_gai_strerror
#endif
......
......@@ -239,7 +239,9 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen,
return 0;
}
#endif /* !HAVE_GETADDRINFO */
#if !HAVE_GETADDRINFO || HAVE_WINSOCK2_H
const char *ff_gai_strerror(int ecode)
{
switch(ecode) {
......@@ -258,7 +260,7 @@ const char *ff_gai_strerror(int ecode)
return "Unknown error";
}
#endif
#endif /* !HAVE_GETADDRINFO || HAVE_WINSOCK2_H */
int ff_socket_nonblock(int socket, int enable)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment