From 015ec05272cf9742bcfaea1f8884e81c31285f5f Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 26 Jul 2013 00:24:27 +0200 Subject: [PATCH] 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. --- src/node.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node.cc b/src/node.cc index 4e9754f8fb..47a7d5e5cf 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1528,15 +1528,15 @@ static gid_t gid_by_name(Handle value) { static Handle 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 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)); }