diff options
author | Jim Meyering <jim@meyering.net> | 2003-03-02 06:09:28 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-03-02 06:09:28 +0000 |
commit | 8c0f32666077b1789d530cc1c761807356dfe9a1 (patch) | |
tree | beb9bf6f47463580f7516dc5b142a03192c5ca78 | |
parent | d8fd301deaa077ab74b3960f030a13e0000bcb6e (diff) | |
download | coreutils-8c0f32666077b1789d530cc1c761807356dfe9a1.tar.xz |
(copy_internal) [un_backup]: When recovering from a
failure to create a hard link, do not remove the entry associating
the source dev/ino with the destination file name.
-rw-r--r-- | src/copy.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/copy.c b/src/copy.c index fcb4854cc..91ae106f5 100644 --- a/src/copy.c +++ b/src/copy.c @@ -1556,11 +1556,14 @@ copy_internal (const char *src_path, const char *dst_path, un_backup: - /* We didn't create the destination. - Remove the entry associating the source dev/ino with the + /* We have failed to create the destination file. + If we've just added a dev/ino entry via the remember_copied + call above (i.e., unless we've just failed to create a hard link), + remove the entry associating the source dev/ino with the destination file name, so we don't try to `preserve' a link to a file we didn't create. */ - forget_created (src_sb.st_ino, src_sb.st_dev); + if (earlier_file == NULL) + forget_created (src_sb.st_ino, src_sb.st_dev); if (dst_backup) { |