Commit 25694819 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'handle_testing_as_root'


 Tests: Handle that root users on linux can always write to files

Acked-by: Kitware Robot's avatarKitware Robot <>
Merge-request: !173
parents 4380f1ae 4b537c59
......@@ -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);
if (do_write_test &&
kwsys::TEST_FILE_WRITE)) {
<< "TestFileAccess incorrectly indicated that this is a writable file:"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment