summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-05 03:58:42 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-05 03:58:42 +0000
commit192c39532b012b4bec98f1912c61832d96466963 (patch)
treed25a0bf6b0c2b6a772ba0aae08bf116b1eb0a982 /process.c
parent82d85fe441210bf847ef7f5b803a787bb15429d0 (diff)
* process.c (has_privilege): Refine uid/gid check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/process.c b/process.c
index cfa466b..294f1be 100644
--- a/process.c
+++ b/process.c
@@ -3346,7 +3346,7 @@ has_privilege(void)
ret = getresuid(&ruid, &euid, &suid);
if (ret == -1)
rb_sys_fail("getresuid(2)");
- if (ruid != suid)
+ if (euid != suid)
return 1;
}
#else
@@ -3356,7 +3356,7 @@ has_privilege(void)
}
#endif
- if (ruid == 0 || ruid != euid)
+ if (euid == 0 || euid != ruid)
return 1;
#ifdef HAVE_GETRESGID
@@ -3366,7 +3366,7 @@ has_privilege(void)
ret = getresgid(&rgid, &egid, &sgid);
if (ret == -1)
rb_sys_fail("getresgid(2)");
- if (rgid != sgid)
+ if (egid != sgid)
return 0;
}
#else
@@ -3376,7 +3376,7 @@ has_privilege(void)
}
#endif
- if (rgid == 0 || rgid != egid)
+ if (egid == 0 || egid != rgid)
return 1;
return 0;