Browse Source

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.
v0.10.15-release
Ben Noordhuis 12 years ago
parent
commit
015ec05272
  1. 8
      src/node.cc

8
src/node.cc

@ -1528,15 +1528,15 @@ static gid_t gid_by_name(Handle<Value> value) {
static Handle<Value> GetUid(const Arguments& args) { static Handle<Value> GetUid(const Arguments& args) {
HandleScope scope; HandleScope scope;
int uid = getuid(); uid_t uid = getuid();
return scope.Close(Integer::New(uid)); return scope.Close(Integer::NewFromUnsigned(uid));
} }
static Handle<Value> GetGid(const Arguments& args) { static Handle<Value> GetGid(const Arguments& args) {
HandleScope scope; HandleScope scope;
int gid = getgid(); gid_t gid = getgid();
return scope.Close(Integer::New(gid)); return scope.Close(Integer::NewFromUnsigned(gid));
} }

Loading…
Cancel
Save