Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
file: translate libuv error codes to errno names
Browse files Browse the repository at this point in the history
Fixes incorrect error names (ex. ENOEXEC instead of EBADF,
EMLINK instead of ENOENT).

Fixes #1656.
  • Loading branch information
bnoordhuis committed Sep 6, 2011
1 parent 94b0481 commit 56efe9c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/node_file.cc
Expand Up @@ -56,6 +56,12 @@ static Persistent<String> errno_symbol;
static Persistent<String> buf_symbol;
static Persistent<String> oncomplete_sym;

Local<Value> 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);
Expand Down Expand Up @@ -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<const char*>(req->path));
argv[0] = FSError(req->errorno,
NULL,
NULL,
static_cast<const char*>(req->path));
}
} else {
// error value is empty or null for non-error.
Expand Down

0 comments on commit 56efe9c

Please sign in to comment.