Browse Source

Merge branch 'upstream-KWSys' into remove-write-only-dir

# By KWSys Upstream
* upstream-KWSys:
  KWSys 2023-11-29 (433f3d23)
Brad King 2 years ago
parent
commit
165bf3252f
1 changed files with 4 additions and 4 deletions
  1. 4 4
      Source/kwsys/SystemTools.cxx

+ 4 - 4
Source/kwsys/SystemTools.cxx

@@ -2794,14 +2794,14 @@ Status SystemTools::RemoveFile(std::string const& source)
 
 Status SystemTools::RemoveADirectory(std::string const& source)
 {
-  // Add write permission to the directory so we can modify its
-  // content to remove files and directories from it.
+  // Add read and write permission to the directory so we can read
+  // and modify its content to remove files and directories from it.
   mode_t mode = 0;
   if (SystemTools::GetPermissions(source, mode)) {
 #if defined(_WIN32) && !defined(__CYGWIN__)
-    mode |= S_IWRITE;
+    mode |= S_IREAD | S_IWRITE;
 #else
-    mode |= S_IWUSR;
+    mode |= S_IRUSR | S_IWUSR;
 #endif
     SystemTools::SetPermissions(source, mode);
   }