RFR: 8357425: (fs) SecureDirectoryStream setPermissions should use fchmodat [v2]

Brian Burkhalter bpb at openjdk.org
Fri May 30 17:40:38 UTC 2025


On Fri, 30 May 2025 16:50:13 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java line 423:
>> 
>>> 421:                 else if (fchmodatNoFollowSupported())
>>> 422:                     fchmodat(dfd, file, UnixFileModeAttribute.toUnixMode(perms),
>>> 423:                              AT_SYMLINK_NOFOLLOW);
>> 
>> The 4 cases look okay. If you adds`int mode = UnixFileModeAttribute.toUnixMode(perms)` then it would avoid the repeated code and avoid the line splits, just makes it easier to read.
>
>> If you adds`int mode = UnixFileModeAttribute.toUnixMode(perms)` then it would avoid the repeated code and avoid the line splits, just makes it easier to read.
> 
> Agreed.

So changed in https://github.com/openjdk/jdk/pull/25534/commits/66de3e524567deb8718b70c394c8877745de16fe.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25534#discussion_r2116322355


More information about the nio-dev mailing list