From: Paul Eggert Date: Wed, 11 Aug 2004 17:19:25 +0000 (+0000) Subject: (copy_internal): When preserving links, unlink X-Git-Tag: v5.3.0~800 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=367719ba5f1dbd5e2f7fa2466c441f23f66a7c9e;p=thirdparty%2Fcoreutils.git (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. --- diff --git a/src/copy.c b/src/copy.c index 1253035570..61c74c383e 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)))) {