[前][次][番号順一覧][スレッド一覧]

ruby-changes:35316

From: akr <ko1@a...>
Date: Fri, 5 Sep 2014 12:58:49 +0900 (JST)
Subject: [ruby-changes:35316] akr:r47398 (trunk): * process.c (has_privilege): Refine uid/gid check.

akr	2014-09-05 12:58:42 +0900 (Fri, 05 Sep 2014)

  New Revision: 47398

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47398

  Log:
    * process.c (has_privilege): Refine uid/gid check.

  Modified files:
    trunk/ChangeLog
    trunk/process.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47397)
+++ ChangeLog	(revision 47398)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Sep  5 12:57:52 2014  Tanaka Akira  <akr@f...>
+
+	* process.c (has_privilege): Refine uid/gid check.
+
 Fri Sep  5 12:40:55 2014  Tanaka Akira  <akr@f...>
 
 	* configure.in: Check sys/id.h, getuidx and getgidx for AIX.
Index: process.c
===================================================================
--- process.c	(revision 47397)
+++ process.c	(revision 47398)
@@ -3346,7 +3346,7 @@ has_privilege(void) https://github.com/ruby/ruby/blob/trunk/process.c#L3346
         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) https://github.com/ruby/ruby/blob/trunk/process.c#L3356
     }
 #endif
 
-    if (ruid == 0 || ruid != euid)
+    if (euid == 0 || euid != ruid)
         return 1;
 
 #ifdef HAVE_GETRESGID
@@ -3366,7 +3366,7 @@ has_privilege(void) https://github.com/ruby/ruby/blob/trunk/process.c#L3366
         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) https://github.com/ruby/ruby/blob/trunk/process.c#L3376
     }
 #endif
 
-    if (rgid == 0 || rgid != egid)
+    if (egid == 0 || egid != rgid)
         return 1;
 
     return 0;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]