open(O_NOFOLLOW) error when encountered symlink

Pawel Jakub Dawidek pjd at
Sun Mar 13 19:54:54 UTC 2011

On Sat, Mar 12, 2011 at 08:31:32PM +0100, Jilles Tjoelker wrote:
> On Sat, Mar 12, 2011 at 07:01:23PM +0200, Kostik Belousov wrote:
> > Hello,
> > I noted the following discussion and commits in the gnu tar repository:
> >
> > 
> >
> >
> > The issue is that in case of open(path, O_NOFOLLOW), when path is naming
> > a symlink, FreeBSD returns EMLINK error. On the other hand, the POSIX
> > requirement is absolutely clear that it shall be ELOOP.
> > I found FreeBSD commit r35088 that specifically changed the error code
> > from the required ELOOP to EMLINK. I doubt that somebody can remember
> > a reason for the change done more then 12 years ago.
> In fact that change was done hours after the new ELOOP error.

I don't think that POSIX knew about O_NOFOLLOW at that time, so peter@
properly predicted ELOOP, but some evil creature convinced him to change
it to EMLINK.

This is from 2004:

and not a word about O_NOFOLLOW.

PS. I'm voting with both hands to change it to ELOOP.

Pawel Jakub Dawidek             
FreeBSD committer               
Am I Evil? Yes, I Am!           
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url :

More information about the freebsd-standards mailing list