From 22a759b5b548036e980992aeead9c49cfe40bafb Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Wed, 29 Nov 2023 07:53:40 -0500 Subject: 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 --- SystemTools.cxx | 8 ++++---- 1 file 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); } -- cgit v0.12