sureshanaparti commented on a change in pull request #5066:
URL: https://github.com/apache/cloudstack/pull/5066#discussion_r659816586
##########
File path: core/src/main/java/com/cloud/storage/JavaStorageLayer.java
##########
@@ -217,6 +229,19 @@ public boolean mkdirs(String path) {
}
}
+ public boolean isWorldReadable(File file) throws IOException {
+ Set<PosixFilePermission> permissions;
+ permissions = Files.getPosixFilePermissions(
+ Paths.get(file.getAbsolutePath()));
+
+ for (PosixFilePermission permission:permissions) {
+ if (permission.equals(PosixFilePermission.OTHERS_READ)) {
+ return true;
+ }
Review comment:
no need of looping through all permissions, can simply check using
permissions set contains `PosixFilePermission.OTHERS_READ` or not
```
if (permissions.contains(PosixFilePermission.OTHERS_READ)) {
return true;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]