]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: copy: fix build on macos 10.12
authorPádraig Brady <P@draigBrady.com>
Thu, 14 Apr 2022 12:35:22 +0000 (13:35 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 14 Apr 2022 12:37:23 +0000 (13:37 +0100)
* src/copy.c (copy_reg): Handle the case where CLONE_NOOWNERCOPY
is not defined.
Reported by Jeffrey Walton

src/copy.c

index cb31067cda701cac9aae7123f2c8e2ec74027239..b15d919900e178c0667c1ced1c276e87ba6a8f2d 100644 (file)
@@ -1189,9 +1189,14 @@ copy_reg (char const *src_name, char const *dst_name,
   if (*new_dst)
     {
 #if HAVE_FCLONEFILEAT && !USE_XATTR
+/* CLONE_NOOWNERCOPY only available on macos >= 10.13.  */
+# ifndef CLONE_NOOWNERCOPY
+#  define CLONE_NOOWNERCOPY 0
+# endif
       int clone_flags = x->preserve_ownership ? 0 : CLONE_NOOWNERCOPY;
       if (data_copy_required && x->reflink_mode
           && x->preserve_mode && x->preserve_timestamps
+          && (x->preserve_ownership || CLONE_NOOWNERCOPY)
           && (fclonefileat (source_desc, dst_dirfd, dst_relname, clone_flags)
               == 0))
         goto close_src_desc;