diff options
author | rpatters1 <rpatters1@users.noreply.github.com> | 2022-07-27 01:51:35 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 09:51:35 +0300 |
commit | 5a7e3f08886ef2893148c1342fb6021291cf1307 (patch) | |
tree | 923de9ce9c045e8f2f55a5acb6b1551911521068 /src/udp.c | |
parent | d1ad8160cba9e504c9d17665492044a93efdc3ab (diff) | |
download | luasocket-5a7e3f08886ef2893148c1342fb6021291cf1307.tar.gz luasocket-5a7e3f08886ef2893148c1342fb6021291cf1307.tar.bz2 luasocket-5a7e3f08886ef2893148c1342fb6021291cf1307.zip |
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>
Diffstat (limited to 'src/udp.c')
-rwxr-xr-x[-rw-r--r--] | src/udp.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -191,7 +191,7 @@ static int meth_sendto(lua_State *L) { | |||
191 | err = getaddrinfo(ip, port, &aihint, &ai); | 191 | err = getaddrinfo(ip, port, &aihint, &ai); |
192 | if (err) { | 192 | if (err) { |
193 | lua_pushnil(L); | 193 | lua_pushnil(L); |
194 | lua_pushstring(L, gai_strerror(err)); | 194 | lua_pushstring(L, LUA_GAI_STRERROR(err)); |
195 | return 2; | 195 | return 2; |
196 | } | 196 | } |
197 | 197 | ||
@@ -290,7 +290,7 @@ static int meth_receivefrom(lua_State *L) { | |||
290 | INET6_ADDRSTRLEN, portstr, 6, NI_NUMERICHOST | NI_NUMERICSERV); | 290 | INET6_ADDRSTRLEN, portstr, 6, NI_NUMERICHOST | NI_NUMERICSERV); |
291 | if (err) { | 291 | if (err) { |
292 | lua_pushnil(L); | 292 | lua_pushnil(L); |
293 | lua_pushstring(L, gai_strerror(err)); | 293 | lua_pushstring(L, LUA_GAI_STRERROR(err)); |
294 | if (wanted > sizeof(buf)) free(dgram); | 294 | if (wanted > sizeof(buf)) free(dgram); |
295 | return 2; | 295 | return 2; |
296 | } | 296 | } |