summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/node_file.cc14
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