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

Commit

Permalink
Fix test-fs-error-messages.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Sep 5, 2011
1 parent 7272dbd commit f5e486e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions deps/uv/src/unix/fs.c
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
}
Expand Down
15 changes: 9 additions & 6 deletions src/node_file.cc
Expand Up @@ -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<const char*>(req->arg0));
// XXX}
} else {
argv[0] = ErrnoException(req->errorno,
NULL,
"",
static_cast<const char*>(req->path));
}
} else {
// error value is empty or null for non-error.
argv[0] = Local<Value>::New(Null());
Expand Down Expand Up @@ -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)); \
}
Expand Down Expand Up @@ -334,7 +337,7 @@ static Handle<Value> 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));
}
}
Expand Down

0 comments on commit f5e486e

Please sign in to comment.