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.
v0.8.16-release
Ben Noordhuis 2012-09-26 01:20:08 +02:00
parent 8ca44f9928
commit ec03c47c19
1 changed files with 12 additions and 2 deletions

View File

@ -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