Method: File::Stat#owned?

Defined in:
file.c

#owned?Boolean

Returns true if the effective user id of the process is the same as the owner of stat.

File.stat("testfile").owned?      #=> true
File.stat("/etc/passwd").owned?   #=> false

Returns:

  • (Boolean)


5883
5884
5885
5886
5887
5888
# File 'file.c', line 5883

static VALUE
rb_stat_owned(VALUE obj)
{
    if (get_stat(obj)->st_uid == geteuid()) return Qtrue;
    return Qfalse;
}