public Method

Stat.owned?

stat.owned?     true or false

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

Source Code

/*
*  call-seq:
*     stat.owned?    => true or false
*  
*  Returns <code>true</code> if the effective user id of the process is
*  the same as the owner of <i>stat</i>.
*     
*     File.stat("testfile").owned?      #=> true
*     File.stat("/etc/passwd").owned?   #=> false
*     
*/

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

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.