Skip to content

Commit

Permalink
unix: return system error on EAI_SYSTEM
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Jun 17, 2014
1 parent 12bb46c commit dd89381
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/unix/getaddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit dd89381

Please sign in to comment.