diff --git a/file.c b/file.c index 073c9c9..799fc2f 100644 --- a/file.c +++ b/file.c @@ -5115,11 +5115,12 @@ rb_stat_grpowned(VALUE obj) 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; @@ -5148,17 +5149,18 @@ rb_stat_r(VALUE obj) 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 @@ -5208,11 +5210,12 @@ rb_stat_wr(VALUE obj) 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; @@ -5241,17 +5244,18 @@ rb_stat_w(VALUE obj) 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 @@ -5347,7 +5351,7 @@ rb_stat_X(VALUE obj) 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