summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-07-26 00:24:27 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2013-07-26 00:29:03 +0200
commit015ec05272cf9742bcfaea1f8884e81c31285f5f (patch)
tree1501174e77df7a5510fb2515d71e57694bd6706e
parent0de5b831e2e8f1de5ce16d8a002ce246ceea6e76 (diff)
downloadnode-015ec05272cf9742bcfaea1f8884e81c31285f5f.tar.gz
src: fix process.getuid() return value
And process.getgid() too. Commit ed80638 changed fs.chown() and fs.fchown() to only accept unsigned integers. Make process.getuid() and process.getgid() follow suit. This commit should unbreak npm on OS X - it's hitting the new 'uid must be an unsigned int' check when installing as e.g. user 'nobody' (which has an UID of -2 in /etc/passwd or 4294967294 when cast to an uid_t.) Fixes #5904.
-rw-r--r--src/node.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/node.cc b/src/node.cc
index 4e9754f8f..47a7d5e5c 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1528,15 +1528,15 @@ static gid_t gid_by_name(Handle<Value> value) {
static Handle<Value> GetUid(const Arguments& args) {
HandleScope scope;
- int uid = getuid();
- return scope.Close(Integer::New(uid));
+ uid_t uid = getuid();
+ return scope.Close(Integer::NewFromUnsigned(uid));
}
static Handle<Value> GetGid(const Arguments& args) {
HandleScope scope;
- int gid = getgid();
- return scope.Close(Integer::New(gid));
+ gid_t gid = getgid();
+ return scope.Close(Integer::NewFromUnsigned(gid));
}