aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/tarfile.cc
diff options
context:
space:
mode:
authorYorick van Pelt <yorick@yorickvanpelt.nl>2021-12-10 17:03:51 +0100
committerYorick van Pelt <yorick@yorickvanpelt.nl>2021-12-10 17:03:51 +0100
commit0e0de90b35b61edcfae3030c150b9d7e42bf39fe (patch)
tree1f978a79b2546e775a73fa59ad84c1c453b78fc6 /src/libutil/tarfile.cc
parentbe1055f2cc8841954521bf30a6f886cf3c807a28 (diff)
extract_archive: fix "Hard-link target '...'" error
Fixes #5741
Diffstat (limited to 'src/libutil/tarfile.cc')
-rw-r--r--src/libutil/tarfile.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc
index 934b70162..790bc943a 100644
--- a/src/libutil/tarfile.cc
+++ b/src/libutil/tarfile.cc
@@ -96,6 +96,13 @@ static void extract_archive(TarArchive & archive, const Path & destDir)
archive_entry_copy_pathname(entry,
(destDir + "/" + name).c_str());
+ // Patch hardlink path
+ const char *original_hardlink = archive_entry_hardlink(entry);
+ if (original_hardlink) {
+ archive_entry_copy_hardlink(entry,
+ (destDir + "/" + original_hardlink).c_str());
+ }
+
archive.check(archive_read_extract(archive.archive, entry, flags));
}