Răsfoiți Sursa

Merge branch 'upstream-KWSys' into update-kwsys

# By KWSys Upstream
* upstream-KWSys:
  KWSys 2020-04-01 (25694819)
Brad King 5 ani în urmă
părinte
comite
afe8a5eb3f
1 a modificat fișierele cu 8 adăugiri și 1 ștergeri
  1. 8 1
      Source/kwsys/testSystemTools.cxx

+ 8 - 1
Source/kwsys/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:"