Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fs: fix stat() reporting for large files

Use Number::New(), not Integer::New(). Large values won't fit in an Integer.

Apply to the size, ino and blocks fields.
  • Loading branch information...
commit ec03c47c192c9198a135acf51b114f43086b17c3 1 parent 8ca44f9
@bnoordhuis bnoordhuis authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/node_file.cc
View
14 src/node_file.cc
@@ -321,15 +321,25 @@ Local<Object> BuildStatsObject(const uv_statbuf_t* s) {
stats->Set(name##_symbol, val); \
}
X(dev)
- X(ino)
X(mode)
X(nlink)
X(uid)
X(gid)
X(rdev)
- X(size)
# if defined(__POSIX__)
X(blksize)
+# endif
+#undef X
+
+#define X(name) \
+ { \
+ Local<Value> val = Number::New(static_cast<double>(s->st_##name)); \
+ if (val.IsEmpty()) return Local<Object>(); \
+ stats->Set(name##_symbol, val); \
+ }
+ X(ino)
+ X(size)
+# if defined(__POSIX__)
X(blocks)
# endif
#undef X
Please sign in to comment.
Something went wrong with that request. Please try again.