1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

LibArchive: Support writing paths up to 255 characters

The POSIX.1-1988 limit was 100, but with the ustar prefix field it's 255
(kinda).
This commit is contained in:
Peter Elliott 2022-10-24 20:47:07 -06:00 committed by Linus Groh
parent 9ae36e2035
commit 612a3324d7
3 changed files with 22 additions and 2 deletions

View file

@ -133,7 +133,7 @@ void TarOutputStream::add_directory(String const& path, mode_t mode)
VERIFY(!m_finished);
TarFileHeader header {};
header.set_size(0);
header.set_filename(String::formatted("{}/", path)); // Old tar implementations assume directory names end with a /
header.set_filename_and_prefix(String::formatted("{}/", path)); // Old tar implementations assume directory names end with a /
header.set_type_flag(TarFileType::Directory);
header.set_mode(mode);
header.set_magic(gnu_magic);
@ -149,7 +149,7 @@ void TarOutputStream::add_file(String const& path, mode_t mode, ReadonlyBytes by
VERIFY(!m_finished);
TarFileHeader header {};
header.set_size(bytes.size());
header.set_filename(path);
header.set_filename_and_prefix(path);
header.set_type_flag(TarFileType::NormalFile);
header.set_mode(mode);
header.set_magic(gnu_magic);