Subject: Re: O_REG_ONLY, O_NOFOLLOW, open_ass(), and other such beasts
To: Andrew Brown <atatat@atatdot.net>
From: Warner Losh <imp@village.org>
List: tech-kern
Date: 12/05/2000 22:40:11
In message <20001206002102.A3355@noc.untraceable.net> Andrew Brown writes:
: >FreeBSD implements O_NOFOLLOW as folllows:
: >     If O_NOFOLLOW is used in the mask and the target file passed to
: >     open() is a symbolic link then the open() will fail.
: >
: >Just as an FYI.  If you are going to do something different than the
: >above, then a different name might be in order.
: 
: i'm curious...i just perused the freebsd source, but was not able to
: tell quickly if it handles the case of a symlink in the path to the
: target.  presumably, if i tell it to open /tmp/foo/bar and bar is a
: symlink, that will fail.  but what if foo is a symlink?

I believe that it succeeds.  This is so that 'ln -s /var/tmp /tmp'
would work.  One could debate the merits of this, but that's what it
does.

I beleive it was put in so that core files could be opened from the
kernel and written to w/o worring about a symlinks.  It was just
recently documented however.

Warner