1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:45:07 +00:00

Userland: tar: support extracting gzipped files

This commit is contained in:
Peter Elliott 2020-10-03 11:59:41 -07:00 committed by Andreas Kling
parent b7c7c80ee2
commit 1b3f9c170c
5 changed files with 27 additions and 8 deletions

View file

@ -111,7 +111,7 @@ void TarStream::advance()
m_finished = true;
return;
}
if (m_header.magic() == "") {
if (!valid()) {
m_finished = true;
return;
}
@ -119,6 +119,11 @@ void TarStream::advance()
ASSERT(m_stream.discard_or_error(block_size - sizeof(Header)));
}
bool TarStream::valid() const
{
return header().magic() == ustar_magic;
}
TarFileStream TarStream::file_contents()
{
ASSERT(!m_finished);