Merge pull request #243 from mojca/eai-undefined

EAI_OVERFLOW, AI_NUMERICSERV: put behind #ifdef so this works on Mac OS X 10.4 and 10.5.
This commit is contained in:
Diego Nehab 2019-02-26 14:09:00 -03:00 committed by GitHub
commit 34d525984c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -188,7 +188,10 @@ static int meth_sendto(lua_State *L) {
memset(&aihint, 0, sizeof(aihint)); memset(&aihint, 0, sizeof(aihint));
aihint.ai_family = udp->family; aihint.ai_family = udp->family;
aihint.ai_socktype = SOCK_DGRAM; aihint.ai_socktype = SOCK_DGRAM;
aihint.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV; aihint.ai_flags = AI_NUMERICHOST;
#ifdef AI_NUMERICSERV
aihint.ai_flags |= AI_NUMERICSERV;
#endif
err = getaddrinfo(ip, port, &aihint, &ai); err = getaddrinfo(ip, port, &aihint, &ai);
if (err) { if (err) {
lua_pushnil(L); lua_pushnil(L);

View File

@ -440,7 +440,9 @@ LUASOCKET_PRIVATE const char *socket_gaistrerror(int err) {
case EAI_FAMILY: return PIE_FAMILY; case EAI_FAMILY: return PIE_FAMILY;
case EAI_MEMORY: return PIE_MEMORY; case EAI_MEMORY: return PIE_MEMORY;
case EAI_NONAME: return PIE_NONAME; case EAI_NONAME: return PIE_NONAME;
#ifdef EAI_OVERFLOW
case EAI_OVERFLOW: return PIE_OVERFLOW; case EAI_OVERFLOW: return PIE_OVERFLOW;
#endif
#ifdef EAI_PROTOCOL #ifdef EAI_PROTOCOL
case EAI_PROTOCOL: return PIE_PROTOCOL; case EAI_PROTOCOL: return PIE_PROTOCOL;
#endif #endif