This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with stat


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]