extract_archive: fix "Hard-link target '...'" error

Fixes #5741
This commit is contained in:
Yorick van Pelt 2021-12-10 17:03:51 +01:00
parent be1055f2cc
commit 0e0de90b35
No known key found for this signature in database
GPG key ID: D8D3CC6D951384DE

View file

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