Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
sunos: add getaddrinfo() compatibility hack
Browse files Browse the repository at this point in the history
getaddrinfo() returns EAI_MEMORY if strlen(hostname) >= MAXHOSTNAMELEN
  • Loading branch information
bnoordhuis committed Nov 10, 2011
1 parent 04dfd46 commit 26806e2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/unix/core.c
Expand Up @@ -589,6 +589,10 @@ int64_t uv_timer_get_repeat(uv_timer_t* timer) {
static int uv_getaddrinfo_done(eio_req* req) {
uv_getaddrinfo_t* handle = req->data;
struct addrinfo *res = handle->res;
#if __sun
size_t hostlen = strlen(handle->hostname);
#endif

handle->res = NULL;

uv_unref(handle->loop);
Expand All @@ -605,6 +609,10 @@ static int uv_getaddrinfo_done(eio_req* req) {
} else if (handle->retcode == EAI_NONAME) {
#endif
uv__set_sys_error(handle->loop, ENOENT); /* FIXME compatibility hack */
#if __sun
} else if (handle->retcode == EAI_MEMORY && hostlen >= MAXHOSTNAMELEN) {
uv__set_sys_error(handle->loop, ENOENT);
#endif
} else {
handle->loop->last_err.code = UV_EADDRINFO;
handle->loop->last_err.sys_errno_ = handle->retcode;
Expand Down

0 comments on commit 26806e2

Please sign in to comment.