summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-05-11 07:33:00 +0000
committerJim Meyering <jim@meyering.net>2006-05-11 07:33:00 +0000
commitf1d1ee91217d08527c6bf7682987339e38116268 (patch)
tree38cb31c45afbb414d4c3c98547f3ba82dcab6d6f /src
parent029057a361b40236bdfd3636473f64007717839c (diff)
downloadcoreutils-f1d1ee91217d08527c6bf7682987339e38116268.tar.xz
(copy_internal): Don't explicitly unlink the destination
when moving a symlink into the place of an existing non-directory. Reported by Joshua Hudson.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/copy.c b/src/copy.c
index e966a951b..645b90b46 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1230,8 +1230,10 @@ copy_internal (char const *src_name, char const *dst_name,
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_ISLNK (src_sb.st_mode))))
+ || (!x->move_mode
+ && x->dereference == DEREF_NEVER
+ && S_ISLNK (src_sb.st_mode))
+ ))
{
if (unlink (dst_name) != 0 && errno != ENOENT)
{