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

Commit

Permalink
fs: fix stat() reporting for large files
Browse files Browse the repository at this point in the history
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
bnoordhuis committed Sep 25, 2012
1 parent 8ca44f9 commit ec03c47
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/node_file.cc
Expand Up @@ -321,15 +321,25 @@ Local<Object> BuildStatsObject(const uv_statbuf_t* s) {
stats->Set(name##_symbol, val); \ stats->Set(name##_symbol, val); \
} }
X(dev) X(dev)
X(ino)
X(mode) X(mode)
X(nlink) X(nlink)
X(uid) X(uid)
X(gid) X(gid)
X(rdev) X(rdev)
X(size)
# if defined(__POSIX__) # if defined(__POSIX__)
X(blksize) 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) X(blocks)
# endif # endif
#undef X #undef X
Expand Down

0 comments on commit ec03c47

Please sign in to comment.