From 1258d9e3efebf8c3dea767aed51c7ad8980ed19e Mon Sep 17 00:00:00 2001 From: isaacs Date: Thu, 7 Mar 2013 15:59:21 -0800 Subject: [PATCH] win: map ERROR_INVALID_FUNCTION to EISDIR This error is raised when calling read() or write() on a directory. A bit of googling turns up some cases where this error can be raised that are not properly mapped to EISDIR, but are also cases that libuv doesn't really care about, like the Password Manager API, GetFirmwareEnvironmentVariable, or CreateTapePartition. If libuv ever needs to handle these cases, then I suppose that the ERROR_INVALID_FUNCTION->EISDIR mapping could be done directly in the fs read() and write() functions, but doing so at this point seems premature, as it makes the error code mapping a bit more messy. Fixes joyent/node#4951 --- src/win/error.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/win/error.c b/src/win/error.c index 7d7d1ea7..0246e6fd 100644 --- a/src/win/error.c +++ b/src/win/error.c @@ -157,6 +157,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) { case ERROR_SEM_TIMEOUT: return UV_ETIMEDOUT; case WSAETIMEDOUT: return UV_ETIMEDOUT; case ERROR_NOT_SAME_DEVICE: return UV_EXDEV; + case ERROR_INVALID_FUNCTION: return UV_EISDIR; default: return UV_UNKNOWN; } }