Give default value of O_NOFOLLOW if it is not defined

Charles Lee littlee at linux.vnet.ibm.com
Wed Dec 28 19:27:49 PST 2011


On 12/28/2011 06:50 PM, Alan Bateman wrote:
> On 28/12/2011 06:34, Charles Lee wrote:
>> Hi net and nio,
>>
>> I would like to propose a fix[1] which give the default value of 
>> O_NOFOLLOW if, one some platforms, O_NOFOLLOW is not defined. Would 
>> anyone help to review this fix?
>>
>> [1]: http://cr.openjdk.java.net/~littlee/OJDK-226/webrev.00/ 
>> <http://cr.openjdk.java.net/%7Elittlee/OJDK-226/webrev.00/>
>>
> Charles - your patch will get over a build issue on platforms where 
> O_NOFOLLOW isn't supported but will mean that NOFOLLOW is ignored at 
> runtime. In order to allow for this it will require changes in several 
> places so that UOE is thrown as expected. I'm on vacation this week 
> but will reply next week with more details.
>
> -Alan
>
Hi Alan,

I have the same concern. So I did a grep on "LinkOption" and found that 
the Usage of O_NOFOLLOW fell into two categories:
1. used to make a value to a boolean: flags.followLinks,  
Util.followLinks. In this situation give O_NOFOLLOW to 0 will do no harm.
2. pass a part of flags to the native directly: open and openat in the 
UnixChannelFactory, UnixPath and UnixSecureDirectoryStream. In this 
situation, maybe we should throw UnsupportedOperationException?

What do you think if I use 0 as a flag to O_NOFOLLOW is not supported?

-- 
Yours Charles



More information about the nio-dev mailing list