Permalink
Browse files

Map EAI_NONAME to ENOENT

  • Loading branch information...
1 parent 28234d7 commit 2c7e8bb137b96e3e05610e98bfe63bb25df9c7e8 @ry ry committed Oct 21, 2011
Showing with 4 additions and 0 deletions.
  1. +2 −0 include/uv.h
  2. +1 −0 src/unix/error.c
  3. +1 −0 src/win/error.c
View
@@ -865,6 +865,8 @@ struct uv_getaddrinfo_s {
*
* uv_freeaddrinfo() must be called after completion to free the addrinfo
* structure.
+ *
+ * On error NXDOMAIN the status code will be non-zero and UV_ENOENT returned.
*/
int uv_getaddrinfo(uv_loop_t*,
uv_getaddrinfo_t* handle,
View
@@ -103,6 +103,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ENOTDIR: return UV_ENOTDIR;
case ENOTCONN: return UV_ENOTCONN;
case EEXIST: return UV_EEXIST;
+ case EAI_NONAME: return UV_ENOENT;
@bnoordhuis
bnoordhuis Nov 7, 2011

This looks like it could report the wrong error on some platforms. EAI_NONAME equals ENOEXEC on sunos, for example.

default: return UV_UNKNOWN;
}
View
@@ -129,6 +129,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_PIPE_BUSY: return UV_EBUSY;
case ERROR_SEM_TIMEOUT: return UV_ETIMEDOUT;
case ERROR_ALREADY_EXISTS: return UV_EEXIST;
+ case WSAHOST_NOT_FOUND: return UV_ENOENT;
default: return UV_UNKNOWN;
}
}

0 comments on commit 2c7e8bb

Please sign in to comment.