mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:07:34 +00:00
LibArchive: Implement proper support for Tar file end markers
Previously this was handled implicitly, as our implementation of Tar would just stop processing input as soon as it found something invalid. However, since we now error out as soon as something is found to be wrong, we require proper handling for zero blocks, which aren't actually fatal.
This commit is contained in:
parent
cb48b9bc30
commit
714f0c3dce
4 changed files with 33 additions and 7 deletions
|
@ -35,7 +35,7 @@ class TarInputStream {
|
|||
public:
|
||||
static ErrorOr<NonnullOwnPtr<TarInputStream>> construct(NonnullOwnPtr<Core::Stream::Stream>);
|
||||
ErrorOr<void> advance();
|
||||
bool finished() const { return m_stream->is_eof(); }
|
||||
bool finished() const { return m_found_end_of_archive || m_stream->is_eof(); }
|
||||
ErrorOr<bool> valid() const;
|
||||
TarFileHeader const& header() const { return m_header; }
|
||||
TarFileStream file_contents();
|
||||
|
@ -51,6 +51,7 @@ private:
|
|||
NonnullOwnPtr<Core::Stream::Stream> m_stream;
|
||||
unsigned long m_file_offset { 0 };
|
||||
int m_generation { 0 };
|
||||
bool m_found_end_of_archive { false };
|
||||
|
||||
friend class TarFileStream;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue