1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:27:46 +00:00

LibTar: Support ustar tar format

Since we ignore both the ustar prefix field and the gnu extended
header right now anyways, we can just accept both formats as the
rest of the header is exactly the same.
This commit is contained in:
Idan Horowitz 2021-03-13 01:32:31 +02:00 committed by Andreas Kling
parent 512431a228
commit 6c1322bdc7
2 changed files with 11 additions and 4 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Peter Elliott <pelliott@ualberta.ca>
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -120,7 +121,9 @@ void TarStream::advance()
bool TarStream::valid() const
{
return header().magic() == ustar_magic;
auto& header_magic = header().magic();
auto& header_version = header().version();
return (header_magic == gnu_magic && header_version == gnu_version) || (header_magic == ustar_magic && header_version == ustar_version);
}
TarFileStream TarStream::file_contents()