Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/external/bsd/libarchive/dist/libarchive Pull up following...
details: https://anonhg.NetBSD.org/src/rev/c0e0dc578a1c
branches: netbsd-9
changeset: 744697:c0e0dc578a1c
user: martin <martin%NetBSD.org@localhost>
date: Mon Feb 10 19:30:00 2020 +0000
description:
Pull up following revision(s) (requested by christos in ticket #692):
external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c: revision 1.5
When extracting symlinks atomically remove them like we do for hard links.
diffstat:
external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c | 15 +++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diffs (32 lines):
diff -r 980ba9a219d2 -r c0e0dc578a1c external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c
--- a/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c Mon Feb 10 19:20:01 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/archive_write_disk_posix.c Mon Feb 10 19:30:00 2020 +0000
@@ -2301,6 +2301,11 @@
}
free(linkname_copy);
archive_string_free(&error_string);
+ /*
+ * Unlinking and linking here is really not atomic,
+ * but doing it right, would require us to construct
+ * an mktemplink() function, and then use rename(2).
+ */
if (a->flags & ARCHIVE_EXTRACT_ATOMIC)
unlink(a->name);
r = link(linkname, a->name) ? errno : 0;
@@ -2341,7 +2346,15 @@
linkname = archive_entry_symlink(a->entry);
if (linkname != NULL) {
#if HAVE_SYMLINK
- int error = symlink(linkname, a->name) ? errno : 0;
+ int error;
+ /*
+ * Unlinking and linking here is really not atomic,
+ * but doing it right, would require us to construct
+ * an mktempsymlink() function, and then use rename(2).
+ */
+ if (a->flags & ARCHIVE_EXTRACT_ATOMIC)
+ unlink(a->name);
+ error = symlink(linkname, a->name) ? errno : 0;
if (error == 0) {
#ifdef HAVE_LSTAT
r = lstat(a->name, &st);
Home |
Main Index |
Thread Index |
Old Index