Feature #11796 ยป reduce_get_stat.patch
| file.c | ||
|---|---|---|
|
static VALUE
|
||
|
rb_stat_r(VALUE obj)
|
||
|
{
|
||
|
struct stat *st = get_stat(obj);
|
||
|
struct stat *st;
|
||
|
#ifdef USE_GETEUID
|
||
|
if (geteuid() == 0) return Qtrue;
|
||
|
#endif
|
||
|
st = get_stat(obj);
|
||
|
#ifdef S_IRUSR
|
||
|
if (rb_stat_owned(obj))
|
||
|
return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
|
||
| ... | ... | |
|
static VALUE
|
||
|
rb_stat_R(VALUE obj)
|
||
|
{
|
||
|
struct stat *st = get_stat(obj);
|
||
|
struct stat *st;
|
||
|
#ifdef USE_GETEUID
|
||
|
if (getuid() == 0) return Qtrue;
|
||
|
#endif
|
||
|
st = get_stat(obj);
|
||
|
#ifdef S_IRUSR
|
||
|
if (rb_stat_rowned(obj))
|
||
|
return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
|
||
|
#endif
|
||
|
#ifdef S_IRGRP
|
||
|
if (rb_group_member(get_stat(obj)->st_gid))
|
||
|
if (rb_group_member(st->st_gid))
|
||
|
return st->st_mode & S_IRGRP ? Qtrue : Qfalse;
|
||
|
#endif
|
||
|
#ifdef S_IROTH
|
||
| ... | ... | |
|
static VALUE
|
||
|
rb_stat_w(VALUE obj)
|
||
|
{
|
||
|
struct stat *st = get_stat(obj);
|
||
|
struct stat *st;
|
||
|
#ifdef USE_GETEUID
|
||
|
if (geteuid() == 0) return Qtrue;
|
||
|
#endif
|
||
|
st = get_stat(obj)
|
||
|
#ifdef S_IWUSR
|
||
|
if (rb_stat_owned(obj))
|
||
|
return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
|
||
| ... | ... | |
|
static VALUE
|
||
|
rb_stat_W(VALUE obj)
|
||
|
{
|
||
|
struct stat *st = get_stat(obj);
|
||
|
struct stat *st;
|
||
|
#ifdef USE_GETEUID
|
||
|
if (getuid() == 0) return Qtrue;
|
||
|
#endif
|
||
|
st = get_stat(obj);
|
||
|
#ifdef S_IWUSR
|
||
|
if (rb_stat_rowned(obj))
|
||
|
return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
|
||
|
#endif
|
||
|
#ifdef S_IWGRP
|
||
|
if (rb_group_member(get_stat(obj)->st_gid))
|
||
|
if (rb_group_member(st->st_gid))
|
||
|
return st->st_mode & S_IWGRP ? Qtrue : Qfalse;
|
||
|
#endif
|
||
|
#ifdef S_IWOTH
|
||
| ... | ... | |
|
return st->st_mode & S_IXUSR ? Qtrue : Qfalse;
|
||
|
#endif
|
||
|
#ifdef S_IXGRP
|
||
|
if (rb_group_member(get_stat(obj)->st_gid))
|
||
|
if (rb_group_member(st->st_gid))
|
||
|
return st->st_mode & S_IXGRP ? Qtrue : Qfalse;
|
||
|
#endif
|
||
|
#ifdef S_IXOTH
|
||