From 56efe9cbc5660b5b9bfa22d5ee64f186fa367b87 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 6 Sep 2011 16:30:48 +0200 Subject: [PATCH] file: translate libuv error codes to errno names Fixes incorrect error names (ex. ENOEXEC instead of EBADF, EMLINK instead of ENOENT). Fixes #1656. --- src/node_file.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/node_file.cc b/src/node_file.cc index a523a933600..e0196a4a073 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -56,6 +56,12 @@ static Persistent errno_symbol; static Persistent buf_symbol; static Persistent oncomplete_sym; +Local FSError(int errorno, + const char *syscall = NULL, + const char *msg = NULL, + const char *path = NULL); + + static inline bool SetCloseOnExec(int fd) { #ifdef __POSIX__ return (fcntl(fd, F_SETFD, FD_CLOEXEC) != -1); @@ -94,12 +100,12 @@ static void After(uv_fs_t *req) { // If the request doesn't have a path parameter set. if (!req->path) { - argv[0] = ErrnoException(req->errorno); + argv[0] = FSError(req->errorno); } else { - argv[0] = ErrnoException(req->errorno, - NULL, - "", - static_cast(req->path)); + argv[0] = FSError(req->errorno, + NULL, + NULL, + static_cast(req->path)); } } else { // error value is empty or null for non-error.