file: translate libuv error codes to errno names
Fixes incorrect error names (ex. ENOEXEC instead of EBADF, EMLINK instead of ENOENT). Fixes #1656.
This commit is contained in:
parent
94b0481a56
commit
56efe9cbc5
@ -56,6 +56,12 @@ static Persistent<String> errno_symbol;
|
|||||||
static Persistent<String> buf_symbol;
|
static Persistent<String> buf_symbol;
|
||||||
static Persistent<String> oncomplete_sym;
|
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) {
|
static inline bool SetCloseOnExec(int fd) {
|
||||||
#ifdef __POSIX__
|
#ifdef __POSIX__
|
||||||
return (fcntl(fd, F_SETFD, FD_CLOEXEC) != -1);
|
return (fcntl(fd, F_SETFD, FD_CLOEXEC) != -1);
|
||||||
@ -94,11 +100,11 @@ static void After(uv_fs_t *req) {
|
|||||||
// If the request doesn't have a path parameter set.
|
// If the request doesn't have a path parameter set.
|
||||||
|
|
||||||
if (!req->path) {
|
if (!req->path) {
|
||||||
argv[0] = ErrnoException(req->errorno);
|
argv[0] = FSError(req->errorno);
|
||||||
} else {
|
} else {
|
||||||
argv[0] = ErrnoException(req->errorno,
|
argv[0] = FSError(req->errorno,
|
||||||
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
"",
|
|
||||||
static_cast<const char*>(req->path));
|
static_cast<const char*>(req->path));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user