summaryrefslogtreecommitdiff
path: root/src/copy.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-11-11 13:19:36 +0000
committerJim Meyering <jim@meyering.net>1999-11-11 13:19:36 +0000
commit1b6c640f464fe3bf8b2923d5be4e6d30460794f5 (patch)
treee41fd72aaef5572368ba17bb183227834d694384 /src/copy.c
parent101ae141c6174f4971a1533ef2eb298ebb1de44a (diff)
downloadcoreutils-1b6c640f464fe3bf8b2923d5be4e6d30460794f5.tar.xz
(copy_internal): Treat src and dest as the `same' in
`mv src symlink-to-src' when src and dest are on different partitions. Otherwise, that `mv' command would silently remove `src'. Reported by Michael Stone.
Diffstat (limited to 'src/copy.c')
-rw-r--r--src/copy.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/copy.c b/src/copy.c
index e06acc14a..9d8c0c070 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -429,9 +429,11 @@ copy_internal (const char *src_path, const char *dst_path,
&& ! x->force
/* Allow them to be the same (and don't set `same') if
- we're in move mode and the target is a symlink. */
+ we're in move mode and the target is a symlink
+ on the same partition. */
&& !(move_mode
- && S_ISLNK (dst_sb.st_mode))
+ && S_ISLNK (dst_sb.st_mode)
+ && src_sb.st_dev == dst_sb.st_dev)
/* If we're making a backup, we'll detect the problem case in
copy_reg because SRC_PATH will no longer exist. Allowing