(same_file_ok): When moving a symlink onto itself,
authorJim Meyering <jim@meyering.net>
Sat, 13 Jan 2001 15:48:32 +0000 (15:48 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 13 Jan 2001 15:48:32 +0000 (15:48 +0000)
don't remove the symlink.  Reported by David Luyer as Debian bug#82089,
via Michael Stone.

src/copy.c

index f07a9ea..b5e0989 100644 (file)
@@ -424,7 +424,7 @@ same_file_ok (const char *src_path, const struct stat *src_sb,
         know this here IFF preserving symlinks (aka xstat == lstat),
         then it's ok.  */
       if (S_ISLNK (src_sb->st_mode) && S_ISLNK (dst_sb->st_mode))
-       return 1;
+       return ! same_name (src_path, dst_path);
 
       src_sb_link = src_sb;
       dst_sb_link = dst_sb;