/*
* call-seq:
* File.lstat(file_name) => stat
*
* Same as <code>File::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
* File.lstat("link2test").size #=> 8
* File.stat("link2test").size #=> 66
*
*/
static VALUE
rb_file_s_lstat(klass, fname)
VALUE klass, fname;
{
#ifdef HAVE_LSTAT
struct stat st;
SafeStringValue(fname);
if (lstat(StringValueCStr(fname), &st) == -1) {
rb_sys_fail(RSTRING(fname)->ptr);
}
return stat_new(&st);
#else
return rb_file_s_stat(klass, fname);
#endif
}