summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-08-11 17:19:25 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-08-11 17:19:25 +0000
commit367719ba5f1dbd5e2f7fa2466c441f23f66a7c9e (patch)
tree966bc50a01e693f4b80210683c5ba2ce3afede63 /src
parenteb1d2a52ddad0502e1dd8eae3a9d3814f54ba006 (diff)
downloadcoreutils-367719ba5f1dbd5e2f7fa2466c441f23f66a7c9e.tar.xz
(copy_internal): When preserving links, unlink
a destination with link count greater than one. This is so that commands like "cp -a" don't get confused when copying into a destination that already contains many hard links.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/copy.c b/src/copy.c
index 125303557..61c74c383 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1079,6 +1079,7 @@ copy_internal (const char *src_path, const char *dst_path,
}
else if (! S_ISDIR (dst_sb.st_mode)
&& (x->unlink_dest_before_opening
+ || (x->preserve_links && 1 < dst_sb.st_nlink)
|| (x->dereference == DEREF_NEVER
&& ! S_ISREG (src_sb.st_mode))))
{