RFR: 8356127: (fs) UnixFileSystemProvider.implDelete could save a syscall in some cases [v3]
Brian Burkhalter
bpb at openjdk.org
Fri May 9 06:31:51 UTC 2025
On Fri, 9 May 2025 06:26:28 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> 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.
But on second thought you might be right.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25107#discussion_r2081019047
More information about the nio-dev
mailing list