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

Commit

Permalink
Browse files Browse the repository at this point in the history
fs: don't assert on uv_fs_*() errors
Pass errors to the JS callbacks, don't assert in C++ land.

Fixes among other things the case where Node aborts because uv_fs_futimes()
returns ENOSYS.
  • Loading branch information
Shigeki Ohtsu authored and bnoordhuis committed Jan 20, 2012
1 parent 0f33768 commit 2156e5e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/node_file.cc
Expand Up @@ -226,11 +226,17 @@ struct fs_req_wrap {

#define ASYNC_CALL(func, callback, ...) \
FSReqWrap* req_wrap = new FSReqWrap(); \
int r = uv_fs_##func(Loop(), &req_wrap->req_, \
int r = uv_fs_##func(Loop(), &req_wrap->req_, \
__VA_ARGS__, After); \
assert(r == 0); \
req_wrap->object_->Set(oncomplete_sym, callback); \
req_wrap->Dispatched(); \
if (r < 0) { \
uv_fs_t* req = &req_wrap->req_; \
req->result = r; \
req->path = NULL; \
req->errorno = uv_last_error(uv_default_loop()).code; \

This comment has been minimized.

Copy link
@shigeki

shigeki Jan 20, 2012

Is uv_default_loop() to be Loop() after isolate supported?

This comment has been minimized.

Copy link
@bnoordhuis

bnoordhuis Jan 20, 2012

Member

Good catch, I missed that one. Fixed in 4e52477.

After(req); \
} \
return scope.Close(req_wrap->object_);

#define SYNC_CALL(func, path, ...) \
Expand Down

0 comments on commit 2156e5e

Please sign in to comment.