/* * call-seq: * file.lstat => stat * * Same as <code>IO#stat</code>, but does not follow the last symbolic * link. Instead, reports on the link itself. * * File.symlink("testfile", "link2test") #=> 0 * File.stat("testfile").size #=> 66 * f = File.new("link2test") * f.lstat.size #=> 8 * f.stat.size #=> 66 */ static VALUE rb_file_lstat(obj) VALUE obj; { #ifdef HAVE_LSTAT OpenFile *fptr; struct stat st; rb_secure(2); GetOpenFile(obj, fptr); if (!fptr->path) return Qnil; if (lstat(fptr->path, &st) == -1) { rb_sys_fail(fptr->path); } return stat_new(&st); #else return rb_io_stat(obj); #endif }