Skip to content

Commit 015ec05

Browse files
committed
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.
1 parent 0de5b83 commit 015ec05

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/node.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,15 +1528,15 @@ static gid_t gid_by_name(Handle<Value> value) {
15281528

15291529
static Handle<Value> GetUid(const Arguments& args) {
15301530
HandleScope scope;
1531-
int uid = getuid();
1532-
return scope.Close(Integer::New(uid));
1531+
uid_t uid = getuid();
1532+
return scope.Close(Integer::NewFromUnsigned(uid));
15331533
}
15341534

15351535

15361536
static Handle<Value> GetGid(const Arguments& args) {
15371537
HandleScope scope;
1538-
int gid = getgid();
1539-
return scope.Close(Integer::New(gid));
1538+
gid_t gid = getgid();
1539+
return scope.Close(Integer::NewFromUnsigned(gid));
15401540
}
15411541

15421542

0 commit comments

Comments
 (0)