aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-12-13 13:37:40 +0100
committerGitHub <noreply@github.com>2021-12-13 13:37:40 +0100
commit84497119ad95d5ed187aba92970f333765e71e51 (patch)
treeb708bc01b0156706b38c3a9486d38ea1206719e7 /src
parentec33014e230aabbdfb8ce597ea80d07a4b936aaa (diff)
parent0e0de90b35b61edcfae3030c150b9d7e42bf39fe (diff)
Merge pull request #5761 from yorickvP/fix-5741
extract_archive: fix "Hard-link target '...'" error
Diffstat (limited to 'src')
-rw-r--r--src/libutil/tarfile.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libutil/tarfile.cc b/src/libutil/tarfile.cc
index 50e691a3d..790bc943a 100644
--- a/src/libutil/tarfile.cc
+++ b/src/libutil/tarfile.cc
@@ -93,9 +93,16 @@ static void extract_archive(TarArchive & archive, const Path & destDir)
else
archive.check(r);
- archive_entry_set_pathname(entry,
+ 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));
}