summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-05-23 20:37:16 +0000
committerJim Meyering <jim@meyering.net>1999-05-23 20:37:16 +0000
commit645015312e38b3d8a4692572077f48f34fe63a08 (patch)
treed4d87f3e255cf41be3b815bc41da12b83593a7a3
parent642d2507813ed33beaf1ab5b3ef7c35f6b0648c4 (diff)
downloadcoreutils-645015312e38b3d8a4692572077f48f34fe63a08.tar.xz
Remove today's earlier misguided attempts.
Add a single condition to the existing sameness test.
-rw-r--r--src/copy.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/copy.c b/src/copy.c
index 070c41983..1a6694ebb 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -461,7 +461,8 @@ copy_internal (const char *src_path, const char *dst_path,
if (x->hard_link)
return 0;
- if (x->backup_type == none && !x->force)
+ if (x->backup_type == none
+ && (!x->force || same_name (src_path, dst_path)))
{
error (0, 0, _("`%s' and `%s' are the same file"),
src_path, dst_path);
@@ -569,15 +570,6 @@ copy_internal (const char *src_path, const char *dst_path,
}
else
{
- if (SAME_INODE (src_sb, dst_sb)
- && (src_sb.st_nlink == 1
- || same_name (src_path, dst_path)))
- {
- error (0, 0, _("`%s' and `%s' are the same file"),
- src_path, dst_path);
- return 1;
- }
-
if (unlink (dst_path) && errno != ENOENT)
{
error (0, errno, _("cannot remove old link to `%s'"),