summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2020-04-01 14:13:48 (GMT)
committerBrad King <brad.king@kitware.com>2020-04-01 14:14:59 (GMT)
commit976d29b9bd23897f47aa5afd8af621e8970d2b76 (patch)
treef11d20b2b37a691a0e457c2c2edd1a65671fa734
parent9d3b9ec4ab1a2756c54f2af2b418b8818268c964 (diff)
downloadCMake-976d29b9bd23897f47aa5afd8af621e8970d2b76.zip
CMake-976d29b9bd23897f47aa5afd8af621e8970d2b76.tar.gz
CMake-976d29b9bd23897f47aa5afd8af621e8970d2b76.tar.bz2
KWSys 2020-04-01 (25694819)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 256948196860967904712e0c8b242057d8ea3380 (master). Upstream Shortlog ----------------- Robert Maynard (1): 4b537c59 Tests: Handle that root users on linux can always write to files
-rw-r--r--testSystemTools.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 670e8dc..aa38aec 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -328,7 +328,14 @@ static bool CheckFileOperations()
}
// While we're at it, check proper TestFileAccess functionality.
- if (kwsys::SystemTools::TestFileAccess(testNewFile,
+ bool do_write_test = true;
+#if defined(__linux__)
+ // If we are running as root on linux ignore this check, as
+ // root can always write to files
+ do_write_test = (getuid() != 0);
+#endif
+ if (do_write_test &&
+ kwsys::SystemTools::TestFileAccess(testNewFile,
kwsys::TEST_FILE_WRITE)) {
std::cerr
<< "TestFileAccess incorrectly indicated that this is a writable file:"