Problem with stat
Eric Blake
ebb9@byu.net
Tue Jun 26 14:46:00 GMT 2007
David Kastrup <dak <at> gnu.org> writes:
> >> fstat, yes. But shouldn't stat be able to report S_ISLNK on a broken
> >> link?
> >
> > No. It must fail with ENOENT.
> > http://www.opengroup.org/onlinepubs/009695399/functions/stat.html
>
> No information there. "component of a path" has nothing to do with
> symlink resolution.
>
"If the named file is a symbolic link, the stat() function shall continue
pathname resolution using the contents of the symbolic link, and shall return
information pertaining to the resulting file if the file exists."
In other words, if file is a broken symlink, symlink resolution MUST take
place, at which point, the brokenness of the symlink means that stat() MUST
fail with ENOENT because a component of the path does not exist. Cygwin is
correct here, as is Linux.
--
Eric Blake
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list