fix(build): Use gai_strerrorA not gai_strerror on Windows
* Explicitly call gai_strerrorA (for Windows builds), so that the code work correctly in 32bit or 64bit builds. * Implement GAI_STRERROR macro to deal with Windows vs. Non-Windows compiles for 64-bit. * make usocket.c consistent with other modules that call macro GAI_STRERROR * Use different name not just different case for macro wrapping function Co-authored-by: Caleb Maclennan <caleb@alerque.com>
This commit is contained in:
parent
d1ad8160cb
commit
5a7e3f0888
5 changed files with 8 additions and 6 deletions
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, LUA_GAI_STRERROR(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, LUA_GAI_STRERROR(err));
|
||||
if (wanted > sizeof(buf)) free(dgram);
|
||||
return 2;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue