RFR: 8356127: (fs) UnixFileSystemProvider.implDelete could save a syscall in some cases [v3]
Brian Burkhalter
bpb at openjdk.org
Fri May 9 06:28:54 UTC 2025
On Fri, 9 May 2025 06:20:13 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>>
>> - 8356127: Change capability naming
>> - Merge
>> - 8356127: Add capability check for EISDIR
>> - 8356127: (fs) UnixFileSystemProvider.implDelete could save a syscall in some cases
>
> src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java line 260:
>
>> 258: // check whether the file is a directory
>> 259: if (e.errno() == EISDIR ||
>> 260: UnixFileAttributes.get(file, false).isDirectory())
>
> If unlink fails (not EISDIR) then shouldn't we just throw the error? I'm not sure why it attempts to stat the file for this case.
I was trying to emulate what would have happened in the previous implementation where rmdir would have been called if the stat showed a directory at issue.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25107#discussion_r2081015269
More information about the nio-dev
mailing list