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

Commit

Permalink
src: fix process.getuid() return value
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bnoordhuis committed Jul 25, 2013
1 parent 0de5b83 commit 015ec05
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/node.cc
Expand Up @@ -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));
}


Expand Down

0 comments on commit 015ec05

Please sign in to comment.