Merge pull request #5761 from yorickvP/fix-5741

extract_archive: fix "Hard-link target '...'" error
This commit is contained in:
Eelco Dolstra 2021-12-13 13:37:40 +01:00 committed by GitHub
commit 84497119ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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));
}