From: Jim Meyering Date: Thu, 11 May 2006 07:33:00 +0000 (+0000) Subject: (copy_internal): Don't explicitly unlink the destination X-Git-Tag: v6.0~414 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1d1ee91217d08527c6bf7682987339e38116268;p=thirdparty%2Fcoreutils.git (copy_internal): Don't explicitly unlink the destination when moving a symlink into the place of an existing non-directory. Reported by Joshua Hudson. --- 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) {