From 26806e2b1c63e8090c261fb3f48f0d36e4bb4445 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 10 Nov 2011 16:37:03 +0000 Subject: [PATCH] sunos: add getaddrinfo() compatibility hack getaddrinfo() returns EAI_MEMORY if strlen(hostname) >= MAXHOSTNAMELEN --- src/unix/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/unix/core.c b/src/unix/core.c index 78b90ff5..4d832413 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -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); @@ -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;