diff options
author | Jim Meyering <jim@meyering.net> | 1999-05-23 19:45:33 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-05-23 19:45:33 +0000 |
commit | 642d2507813ed33beaf1ab5b3ef7c35f6b0648c4 (patch) | |
tree | 08a0ec28bf2b45d6673e4b48991bb90c0af4e549 | |
parent | 00fbb65ec19816d19aa1c23ef447cf783cfe44ea (diff) | |
download | coreutils-642d2507813ed33beaf1ab5b3ef7c35f6b0648c4.tar.xz |
Include same.h.
(copy_internal): Qualify SAME_INODE test with (link-count == 1
|| same_name(...)).
-rw-r--r-- | src/copy.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/copy.c b/src/copy.c index 9246aa07e..070c41983 100644 --- a/src/copy.c +++ b/src/copy.c @@ -32,8 +32,9 @@ #include "savedir.h" #include "copy.h" #include "cp-hash.h" -#include "path-concat.h" #include "dirname.h" +#include "path-concat.h" +#include "same.h" #define DO_CHOWN(Chown, File, New_uid, New_gid) \ (Chown ((File), (x->myeuid == 0 ? (New_uid) : x->myeuid), (New_gid)) \ @@ -568,7 +569,9 @@ copy_internal (const char *src_path, const char *dst_path, } else { - if (SAME_INODE (src_sb, dst_sb)) + 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); |