diff options
author | KWSys Upstream <kwrobot@kitware.com> | 2023-03-08 12:36:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-03-08 12:38:49 (GMT) |
commit | a87ea777d459462471cfb5a6659e8cb250fb971c (patch) | |
tree | a0ca5586ff2a901284f6d79ec88489790cd80419 | |
parent | 5433eea1a9b16435c129042f4481152e834eb519 (diff) | |
download | CMake-a87ea777d459462471cfb5a6659e8cb250fb971c.zip CMake-a87ea777d459462471cfb5a6659e8cb250fb971c.tar.gz CMake-a87ea777d459462471cfb5a6659e8cb250fb971c.tar.bz2 |
KWSys 2023-03-08 (a3ff01ab)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit a3ff01ab80c7bb1e08caceb107f323513efbad47 (master).
Upstream Shortlog
-----------------
Brad King (1):
51272e80 SystemTools: Avoid macOS copyfile semantic differences as root
-rw-r--r-- | SystemTools.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx index 6cdd5a3..3bb7869 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -2528,6 +2528,12 @@ SystemTools::CopyStatus SystemTools::CloneFileContent( return status; #elif defined(__APPLE__) && \ defined(KWSYS_SYSTEMTOOLS_HAVE_MACOS_COPYFILE_CLONE) + // When running as root, copyfile() copies more metadata than we + // want, such as ownership. Pretend it is not available. + if (getuid() == 0) { + return CopyStatus{ Status::POSIX(ENOSYS), CopyStatus::NoPath }; + } + // NOTE: we cannot use `clonefile` as the {a,c,m}time for the file needs to // be updated by `copy_file_if_different` and `copy_file`. if (copyfile(source.c_str(), destination.c_str(), nullptr, |