From c9fa0e656bcf6e214471d9d7f883abf4cf9897ca Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 3 Jul 2021 07:56:38 -0400 Subject: [PATCH] Fix system::archiveDir() adding 10k of padding to the end of memory output. --- src/system.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system.cpp b/src/system.cpp index 17b2944f..c61c442f 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -307,6 +307,8 @@ static void archiveDir(const std::string& archivePath, std::vector* arc // Open archive for writing struct archive* a = archive_write_new(); DEFER({archive_write_free(a);}); + // For some reason libarchive adds 10k of padding to archive_write_open() (but not archive_write_open_filename()) unless this is set to 0. + archive_write_set_bytes_per_block(a, 0); archive_write_set_format_ustar(a); archive_write_add_filter_zstd(a); assert(0 <= compressionLevel && compressionLevel <= 19);