diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-09-26 01:20:08 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-09-26 01:20:56 +0200 |
commit | ec03c47c192c9198a135acf51b114f43086b17c3 (patch) | |
tree | 382f521b696525f682de082ed1ac783b399d95c8 | |
parent | 8ca44f99285c8d557ac2db2e557f3194b6e79583 (diff) | |
download | node-ec03c47c192c9198a135acf51b114f43086b17c3.tar.gz |
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.
-rw-r--r-- | src/node_file.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/node_file.cc b/src/node_file.cc index 89a786b17..59ff414c6 100644 --- a/src/node_file.cc +++ b/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 |