From df9f01f527b4e29e2c05bea82aff6a18bf000f43 Mon Sep 17 00:00:00 2001 From: Robert Patterson Date: Sun, 10 Oct 2021 21:34:44 -0500 Subject: [PATCH] Explicitly call gai_strerrorA (for Windows builds), so that the code work correctly in 32bit or 64bit builds. --- src/inet.c | 4 ++-- src/udp.c | 4 ++-- src/wsocket.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 src/inet.c mode change 100644 => 100755 src/udp.c diff --git a/src/inet.c b/src/inet.c old mode 100644 new mode 100755 index ec73fea..b36ea21 --- a/src/inet.c +++ b/src/inet.c @@ -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); diff --git a/src/udp.c b/src/udp.c old mode 100644 new mode 100755 index 62b6a20..9a69f29 --- a/src/udp.c +++ b/src/udp.c @@ -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; } diff --git a/src/wsocket.c b/src/wsocket.c index 20da330..f62f5fb 100755 --- a/src/wsocket.c +++ b/src/wsocket.c @@ -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); } }