Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Apr 1997 14:01:03 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        jmacd@CS.Berkeley.EDU (Josh MacDonald)
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: O_EXCL
Message-ID:  <199704182101.OAA02785@phaeton.artisoft.com>
In-Reply-To: <199704180627.XAA15953@paris.CS.Berkeley.EDU> from "Josh MacDonald" at Apr 17, 97 11:27:26 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> In the man page for open, it says that O_EXCL causes symlinks not to
> be followed.  However, when I was reading the code, I found that its
> broken.  In the open syscall, it does NDINIT with the FOLLOW flag already
> set, and then in vn_open, which is called shortly thereafter with the
> nameidata struct, it does:
> 
> if ((fmode & O_EXCL) == 0)
>     ndp->.... |= FOLLOW;\
> 
> It looks to me like its broken, and either it should be fixed with the
> trivial fix, or the documentation for open fixed.  

It looks broken because of the explicit compare for zero.  An explicit
compare for zero (x == 0) is a longer, harder to intutively understand
way of saying (!x) that is used because it's somehow stylish (actually,
I think it originated at about the same time the compiler started bitching
about assignments using the lvalue a a boolean in 'if' statements).

So the FOLLOW is set only if the O_EXCL flag is *not* present.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704182101.OAA02785>