summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-11-22 08:37:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-11-22 08:37:11 +0000
commit10ec337f5364bc29fdb50bc3853cfcccd97b92a3 (patch)
tree6965d337e651d76ccf5e0db5dbd9a901ed35de73 /file.c
parent8faf08a4e17b3b7d3621b429688bab9775fbf335 (diff)
* file.c (test_grpowned, rb_stat_grpowned): should honor
supplementary group IDs. [ruby-core:09546] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/file.c b/file.c
index 6c7aace..428a9e9 100644
--- a/file.c
+++ b/file.c
@@ -820,7 +820,7 @@ group_member(gid)
GETGROUPS_T gid;
{
#ifndef _WIN32
- if (getgid() == gid)
+ if (getgid() == gid || getegid() == gid)
return Qtrue;
# ifdef HAVE_GETGROUPS
@@ -882,7 +882,7 @@ eaccess(path, mode)
if (st.st_uid == euid) /* owner */
mode <<= 6;
- else if (getegid() == st.st_gid || group_member(st.st_gid))
+ else if (group_member(st.st_gid))
mode <<= 3;
if ((st.st_mode & mode) == mode) return 0;
@@ -1328,7 +1328,7 @@ test_grpowned(obj, fname)
struct stat st;
if (rb_stat(fname, &st) < 0) return Qfalse;
- if (st.st_gid == getegid()) return Qtrue;
+ if (group_member(st.st_gid)) return Qtrue;
#endif
return Qfalse;
}
@@ -3740,7 +3740,7 @@ rb_stat_grpowned(obj)
VALUE obj;
{
#ifndef _WIN32
- if (get_stat(obj)->st_gid == getegid()) return Qtrue;
+ if (group_member(get_stat(obj)->st_gid)) return Qtrue;
#endif
return Qfalse;
}