static public Method

File.owned?(p1)

File.owned?(file_name)    true or false

Returns true if the named file exists and the effective used id of the calling process is the owner of the file.

Source Code

/*
* call-seq:
*    File.owned?(file_name)   => true or false
*
* Returns <code>true</code> if the named file exists and the
* effective used id of the calling process is the owner of
* the file.
*/

static VALUE
test_owned(obj, fname)
   VALUE obj, fname;
{
   struct stat st;

   if (rb_stat(fname, &st) < 0) return Qfalse;
   if (st.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.