Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libarchive/dist/libarchive In the extract atomi...



details:   https://anonhg.NetBSD.org/src/rev/9504a3286400
branches:  trunk
changeset: 848023:9504a3286400
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 14 19:29:45 2020 +0000

description:
In the extract atomic case, remove the destination hard link first
since it did not get removed before for us. If we wanted to do this
right, we would do the mk*temp() file generation and trying to link
instead of open, and finally when we got the link to succeed, we
would rename the temp link to the final destination name, making
hard link creation atomic. For now we just remove first.

diffstat:

 external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r 6f9b474cba85 -r 9504a3286400 external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c
--- a/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c        Tue Jan 14 19:28:31 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c        Tue Jan 14 19:29:45 2020 +0000
@@ -2301,6 +2301,8 @@
                }
                free(linkname_copy);
                archive_string_free(&error_string);
+               if (a->flags & ARCHIVE_EXTRACT_ATOMIC)
+                       unlink(a->name);
                r = link(linkname, a->name) ? errno : 0;
                /*
                 * New cpio and pax formats allow hardlink entries



Home | Main Index | Thread Index | Old Index