You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/07/02 04:14:33 UTC

[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #5066: CLOUDSTACK-10436:remind users to use correct permission for tmp dir and fixed an NPE

GabrielBrascher commented on a change in pull request #5066:
URL: https://github.com/apache/cloudstack/pull/5066#discussion_r662720705



##########
File path: core/src/main/java/com/cloud/storage/JavaStorageLayer.java
##########
@@ -178,18 +183,25 @@ public long getSize(String path) {
     }
 
     @Override
-    public File createUniqDir() {
+    public File createUniqDir() throws IOException {
         String dirName = System.getProperty("java.io.tmpdir");
         if (dirName != null) {
             File dir = new File(dirName);
             if (dir.exists()) {
+                if (isWorldReadable(dir)) {
+                    if (dir.getAbsolutePath().equals("/tmp")) {

Review comment:
       What do you think of extracting `"/tmp"` into a constant in this class?

##########
File path: core/src/main/java/com/cloud/storage/JavaStorageLayer.java
##########
@@ -178,18 +183,25 @@ public long getSize(String path) {
     }
 
     @Override
-    public File createUniqDir() {
+    public File createUniqDir() throws IOException {
         String dirName = System.getProperty("java.io.tmpdir");
         if (dirName != null) {
             File dir = new File(dirName);
             if (dir.exists()) {
+                if (isWorldReadable(dir)) {
+                    if (dir.getAbsolutePath().equals("/tmp")) {
+                        s_logger.warn("The temp dir is /tmp");
+                    }else {

Review comment:
       Can you please change from  `}else {` to `} else {`?
   
   Just a small change to keep the [conventions](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventions) :slightly_smiling_face:.




-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org