summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2022-04-14 13:35:22 +0100
committerPádraig Brady <P@draigBrady.com>2022-04-14 13:37:23 +0100
commitbcfbcef928cd540e53d35fc2869d9def2fedeb84 (patch)
tree64e2cc04cfc5ad04869d5c127f33eead6b3e8e7a
parent87d5f1e17e32176b262a13262ac3ec16e1970596 (diff)
downloadcoreutils-bcfbcef928cd540e53d35fc2869d9def2fedeb84.tar.gz
build: copy: fix build on macos 10.12
* src/copy.c (copy_reg): Handle the case where CLONE_NOOWNERCOPY is not defined. Reported by Jeffrey Walton
-rw-r--r--src/copy.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/copy.c b/src/copy.c
index cb31067cd..b15d91990 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -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;