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/638a27397da1
branches:  trunk
changeset: 1006424:638a27397da1
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 8c1158bddb6d -r 638a27397da1 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