Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShigeki Ohtsu <ohtsu@iij.ad.jp>2011-11-08 19:27:52 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2012-01-20 17:46:07 +0400
commit2156e5eca10d1dc3bb8155dc70f1dc0718841028 (patch)
tree07edbbbd7a45f32329cd51bb5b4f12f8406c5605 /src
parent0f33768059146250d35148f37de7bd07e35ed851 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/node_file.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/node_file.cc b/src/node_file.cc
index f7d2d87ed11..376ebd98c34 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -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; \
+ After(req); \
+ } \
return scope.Close(req_wrap->object_);
#define SYNC_CALL(func, path, ...) \