Quellcode durchsuchen

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
KWSys Upstream vor 2 Jahren
Ursprung
Commit
a87ea777d4
1 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. 6 0
      SystemTools.cxx

+ 6 - 0
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,