summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2023-11-29 12:53:40 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-29 12:54:35 (GMT)
commit22a759b5b548036e980992aeead9c49cfe40bafb (patch)
tree76fa6a3e1335e104ac6e5d722cd401a47f78a1e0
parent09b90d4377d3bf199114ae9aa65fe30161c2467d (diff)
downloadCMake-22a759b5b548036e980992aeead9c49cfe40bafb.zip
CMake-22a759b5b548036e980992aeead9c49cfe40bafb.tar.gz
CMake-22a759b5b548036e980992aeead9c49cfe40bafb.tar.bz2
KWSys 2023-11-29 (433f3d23)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 433f3d23ffa37f8fa6dd42468933f36c28a9e7fa (master). Upstream Shortlog ----------------- Brad King (1): 9f9ff427 SystemTools: Teach RemoveADirectory to handle non-readable directories
-rw-r--r--SystemTools.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx
index cefb922..53b55f6 100644
--- a/SystemTools.cxx
+++ b/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);
}