RFR: 5041655: (ch) FileLock: negative param and overflow issues [v3]
Alan Bateman
alanb at openjdk.java.net
Tue Feb 8 20:21:14 UTC 2022
On Tue, 8 Feb 2022 20:09:10 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Note that because of this code in the Unix `FileDispatcherImpl.c` setting `size` to `MAX_VALUE - position` is not quite the same as what is there now:
>
> ```
> fl.l_whence = SEEK_SET;
> if (size == (jlong)java_lang_Long_MAX_VALUE) {
> fl.l_len = (off64_t)0;
> } else {
> fl.l_len = (off64_t)size;
> }
> ```
There should be no impact here. If someone calls fc.lock() then it's the equivalent of fc.lock(0, MAX_VALUE, false). The FileLock will be created with size=MAX_VALUE. The code above will just map it to 0 for the call to fcntl.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7254
More information about the nio-dev
mailing list