Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fix test-fs-error-messages.js

  • Loading branch information...
ry committed Sep 5, 2011
1 parent 7272dbd commit f5e486ebabc7c9faeeec126946b0a396426166f0
Showing with 11 additions and 6 deletions.
  1. +2 −0 deps/uv/src/unix/fs.c
  2. +9 −6 src/node_file.cc
@@ -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;
}
}
@@ -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());
@@ -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<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));
}
}

0 comments on commit f5e486e

Please sign in to comment.
You can’t perform that action at this time.