1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

Userland: Open files for save in write-only mode

WavWriter and the shot utility open files with this mode and never
truncate the files, which might leave some contents of a previous file
during overwriting.
This commit is contained in:
Karol Kosek 2023-08-07 17:21:15 +02:00 committed by Jelle Raaijmakers
parent fb305b66c2
commit 55b6e07a0f
2 changed files with 2 additions and 2 deletions

View file

@ -33,7 +33,7 @@ WavWriter::~WavWriter()
ErrorOr<void> WavWriter::set_file(StringView path)
{
m_file = TRY(Core::File::open(path, Core::File::OpenMode::ReadWrite));
m_file = TRY(Core::File::open(path, Core::File::OpenMode::Write));
TRY(m_file->seek(44, SeekMode::SetPosition));
m_finalized = false;
return {};