This commit is contained in:
Antonio Andelic 2023-08-04 14:29:49 +00:00
parent 49ae853ae6
commit 1d793e69f2
2 changed files with 4 additions and 3 deletions

View File

@ -91,12 +91,13 @@ public:
close(archive);
);
auto * entry = archive_entry_new();
struct archive_entry * entry = nullptr;
std::vector<std::string> files;
int error = readNextHeader(archive, &entry);
while (error == ARCHIVE_OK || error == ARCHIVE_RETRY)
{
chassert(entry != nullptr);
std::string name = archive_entry_pathname(entry);
if (!filter || filter(name))
files.push_back(std::move(name));

View File

@ -861,7 +861,7 @@ public:
{
if (!storage->use_table_fd)
{
if (!files_iterator->fromArchive())
if (files_iterator->fromArchive())
{
auto [archive, filename] = files_iterator->nextFileFromArchive();
if (archive.empty())
@ -878,7 +878,7 @@ public:
if (file_enumerator == nullptr)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Failed to find a file in archive {}", archive);
while (file_enumerator->getFileName() != filename)
while (file_enumerator->getFileName() != current_path)
{
if (!file_enumerator->nextFile())
throw Exception(ErrorCodes::LOGICAL_ERROR, "Expected file {} is missing from archive {}", filename, archive);