1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:57:35 +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

@ -160,7 +160,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (edit_image)
output_path = Core::DateTime::now().to_deprecated_string("/tmp/screenshot-%Y-%m-%d-%H-%M-%S.png"sv);
auto file_or_error = Core::File::open(output_path, Core::File::OpenMode::ReadWrite);
auto file_or_error = Core::File::open(output_path, Core::File::OpenMode::Write);
if (file_or_error.is_error()) {
warnln("Could not open '{}' for writing: {}", output_path, file_or_error.error());
return 1;