瀏覽代碼

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
KWSys Upstream 4 年之前
父節點
當前提交
fc5b7905ed
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      testSystemTools.cxx

+ 4 - 3
testSystemTools.cxx

@@ -332,9 +332,10 @@ static bool CheckFileOperations()
 
 
   // While we're at it, check proper TestFileAccess functionality.
   // While we're at it, check proper TestFileAccess functionality.
   bool do_write_test = true;
   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);
   do_write_test = (getuid() != 0);
 #endif
 #endif
   if (do_write_test &&
   if (do_write_test &&