From f1d1ee91217d08527c6bf7682987339e38116268 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 11 May 2006 07:33:00 +0000 Subject: [PATCH] (copy_internal): Don't explicitly unlink the destination when moving a symlink into the place of an existing non-directory. Reported by Joshua Hudson. --- src/copy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/copy.c b/src/copy.c index e966a951bc..645b90b468 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) { -- 2.47.3