diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c index 7ca2275fc2d..e0dc47d78cb 100644 --- a/deps/uv/src/unix/fs.c +++ b/deps/uv/src/unix/fs.c @@ -305,6 +305,7 @@ int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, DIR* dir = opendir(path); if (!dir) { uv_err_new(loop, errno); + req->result = -1; return -1; } @@ -333,6 +334,7 @@ int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, r = closedir(dir); if (r) { uv_err_new(loop, errno); + req->result = -1; return -1; } } diff --git a/src/node_file.cc b/src/node_file.cc index f2d163caff9..44279758748 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -86,11 +86,14 @@ static void After(uv_fs_t *req) { if (req->result == -1) { // If the request doesn't have a path parameter set. - // XXX if (!req->arg0) { + if (!req->path) { argv[0] = ErrnoException(req->errorno); - // XXX } else { - // XXX argv[0] = ErrnoException(req->errorno, NULL, "", static_cast(req->arg0)); - // XXX} + } else { + argv[0] = ErrnoException(req->errorno, + NULL, + "", + static_cast(req->path)); + } } else { // error value is empty or null for non-error. argv[0] = Local::New(Null()); @@ -214,7 +217,7 @@ struct fs_req_wrap { #define SYNC_CALL(func, path, ...) \ fs_req_wrap req_wrap; \ uv_fs_##func(uv_default_loop(), &req_wrap.req, __VA_ARGS__, NULL); \ - if (req_wrap.req.result == -1) { \ + if (req_wrap.req.result < 0) { \ return ThrowException( \ ErrnoException(req_wrap.req.errorno, #func, "", path)); \ } @@ -334,7 +337,7 @@ static Handle Stat(const Arguments& args) { if (args[1]->IsFunction()) { ASYNC_CALL(stat, args[1], *path) } else { - SYNC_CALL(stat, 0, *path) + SYNC_CALL(stat, *path, *path) return scope.Close(BuildStatsObject((NODE_STAT_STRUCT*)SYNC_REQ.ptr)); } }