RFR: 8073061: (fs) Files.copy(foo, bar, REPLACE_EXISTING) deletes bar even if foo is not readable [v6]
Alan Bateman
alanb at openjdk.org
Mon Sep 18 07:40:39 UTC 2023
On Fri, 15 Sep 2023 17:37:30 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Check that the source is readable before deleting the destination.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8073061: Tweak CopyMoveHelper.copyToForeignTarget
src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 901:
> 899: // ensure source can be moved
> 900: try {
> 901: access(source, W_OK);
One small suggestion here is to move this to L900, after UnixFileAttributes.get, as that will avoid the exception handling and means the examination of the source is in one place.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15501#discussion_r1328341604
More information about the nio-dev
mailing list