unix: return system error on EAI_SYSTEM

This commit is contained in:
Saúl Ibarra Corretgé 2014-06-18 01:18:55 +02:00
parent 12bb46c095
commit dd893814ad

View File

@ -34,6 +34,8 @@ static void uv__getaddrinfo_work(struct uv__work* w) {
req->service,
req->hints,
&req->res);
if (req->retcode == EAI_SYSTEM)
req->retcode = -errno;
}
@ -67,7 +69,10 @@ static void uv__getaddrinfo_done(struct uv__work* w, int status) {
req->service = NULL;
req->hostname = NULL;
if (req->retcode == 0) {
if (req->retcode < 0) {
/* EAI_SYSTEM error */
uv__set_sys_error(req->loop, -req->result);
} else if (req->retcode == 0) {
/* OK */
#if defined(EAI_NODATA) /* FreeBSD deprecated EAI_NODATA */
} else if (req->retcode == EAI_NONAME || req->retcode == EAI_NODATA) {