Give default value of O_NOFOLLOW if it is not defined

Alan Bateman Alan.Bateman at oracle.com
Wed Jan 4 07:11:24 PST 2012


On 04/01/2012 14:44, Charles Lee wrote:
>
> I was thinking making the UnixNativeDispatcher.supportsAtSysCalls 
> consistent. But maybe I am wrong. supportsAtSysCalls should only be 
> judged by "at" functions....
> There are some platforms which support "at" functions but do not 
> support O_NOFOLLOWLINK flag...
> You are inspiring me that maybe I should also use lstat some where and 
> fail only when "NOFOLLOW_LINK meets link" :-)
I don't know if there are platforms that support openat but not O_NOFOLLOW.

> :
>
> In the spec NOFOLLOW_LINKS means "Do not follow symbolic links". So if 
> the platform support lstat, lchown etc, does that mean it support 
> NOFOLLOW_LINKS? The spec says NOFOLLOW_LINKS like a behavior not a 
> flag "O_NOFOLLOW".
> It may be a stupid question, maybe someone has already ask that...
I don't think the spec mentions O_NOFOLLOW anywhere but when 
NOFOLLOW_LINKS is specified to a method that opens a file (like 
Files.newByteChannel) then it adds the O_NOFOLLOW flag so that sym links 
aren't followed. The lstat andl chown calls are used read the file 
attributes or setting the file owner and sym links aren't specified. 
Hopefully it is starting to become clear.

-Alan


More information about the nio-dev mailing list