summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2021-06-02 11:24:05 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-02 11:46:47 (GMT)
commitfc5b7905ed8e2ddc45de1cabe0f9dbd8c1484dbb (patch)
tree7d63e950392ba55bc33d0fa5441aabe8937798c8
parent07727928f9e243fd472767c27596b618ada4b5d4 (diff)
downloadCMake-fc5b7905ed8e2ddc45de1cabe0f9dbd8c1484dbb.zip
CMake-fc5b7905ed8e2ddc45de1cabe0f9dbd8c1484dbb.tar.gz
CMake-fc5b7905ed8e2ddc45de1cabe0f9dbd8c1484dbb.tar.bz2
KWSys 2021-06-02 (ad35b3ba)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit ad35b3bae42fe21b8ea1d35799c8f141c9d5a2ec (master). Upstream Shortlog ----------------- Adriaan de Groot (1): e65c5693 testSystemTools: apply root-check to more systems
-rw-r--r--testSystemTools.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 700eaf7..39a19cb 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -332,9 +332,10 @@ static bool CheckFileOperations()
// While we're at it, check proper TestFileAccess functionality.
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
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
+ defined(__NetBSD__) || defined(__DragonFly__)
+ // If we are running as root on POSIX-ish systems (Linux and the BSDs,
+ // at least), ignore this check, as root can always write to files.
do_write_test = (getuid() != 0);
#endif
if (do_write_test &&