diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/inet.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -176,9 +176,24 @@ static int inet_global_getaddrinfo(lua_State *L) | |||
176 | } | 176 | } |
177 | lua_newtable(L); | 177 | lua_newtable(L); |
178 | for (iterator = resolved; iterator; iterator = iterator->ai_next) { | 178 | for (iterator = resolved; iterator; iterator = iterator->ai_next) { |
179 | char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; | 179 | char hbuf[NI_MAXHOST] |
180 | getnameinfo(iterator->ai_addr, (socklen_t) iterator->ai_addrlen, hbuf, | 180 | #ifndef _WINDOWS |
181 | (socklen_t) sizeof(hbuf), sbuf, 0, NI_NUMERICHOST); | 181 | ,sbuf[NI_MAXSERV] |
182 | #endif | ||
183 | ; | ||
184 | ret = getnameinfo(iterator->ai_addr, (socklen_t) iterator->ai_addrlen, hbuf, | ||
185 | (socklen_t) sizeof(hbuf), | ||
186 | #ifdef _WINDOWS | ||
187 | NULL, 0, | ||
188 | #else | ||
189 | sbuf, 0, | ||
190 | #endif | ||
191 | NI_NUMERICHOST); | ||
192 | if(ret){ | ||
193 | lua_pushnil(L); | ||
194 | lua_pushstring(L, socket_gaistrerror(ret)); | ||
195 | return 2; | ||
196 | } | ||
182 | lua_pushnumber(L, i); | 197 | lua_pushnumber(L, i); |
183 | lua_newtable(L); | 198 | lua_newtable(L); |
184 | switch (iterator->ai_family) { | 199 | switch (iterator->ai_family) { |