Explicitly call gai_strerrorA (for Windows builds), so that the code work correctly in 32bit or 64bit builds.
This commit is contained in:
parent
5b18e475f3
commit
df9f01f527
3 changed files with 5 additions and 5 deletions
4
src/inet.c
Normal file → Executable file
4
src/inet.c
Normal file → Executable file
|
@ -253,7 +253,7 @@ int inet_meth_getpeername(lua_State *L, p_socket ps, int family)
|
|||
port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
if (err) {
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, gai_strerror(err));
|
||||
lua_pushstring(L, gai_strerrorA(err));
|
||||
return 2;
|
||||
}
|
||||
lua_pushstring(L, name);
|
||||
|
@ -286,7 +286,7 @@ int inet_meth_getsockname(lua_State *L, p_socket ps, int family)
|
|||
name, INET6_ADDRSTRLEN, port, 6, NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
if (err) {
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, gai_strerror(err));
|
||||
lua_pushstring(L, gai_strerrorA(err));
|
||||
return 2;
|
||||
}
|
||||
lua_pushstring(L, name);
|
||||
|
|
4
src/udp.c
Normal file → Executable file
4
src/udp.c
Normal file → Executable file
|
@ -191,7 +191,7 @@ static int meth_sendto(lua_State *L) {
|
|||
err = getaddrinfo(ip, port, &aihint, &ai);
|
||||
if (err) {
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, gai_strerror(err));
|
||||
lua_pushstring(L, gai_strerrorA(err));
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ static int meth_receivefrom(lua_State *L) {
|
|||
INET6_ADDRSTRLEN, portstr, 6, NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
if (err) {
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, gai_strerror(err));
|
||||
lua_pushstring(L, gai_strerrorA(err));
|
||||
if (wanted > sizeof(buf)) free(dgram);
|
||||
return 2;
|
||||
}
|
||||
|
|
|
@ -429,6 +429,6 @@ const char *socket_gaistrerror(int err) {
|
|||
#ifdef EAI_SYSTEM
|
||||
case EAI_SYSTEM: return strerror(errno);
|
||||
#endif
|
||||
default: return gai_strerror(err);
|
||||
default: return gai_strerrorA(err);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue