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

AK: Make writability violation of FixedMemoryStream non-fatal

Writing to a read-only file is not a program-crashing error either, so
we just return the standard EBADFD (see write(2)) here.
This commit is contained in:
kleines Filmröllchen 2023-09-19 12:02:05 +02:00 committed by Tim Schumacher
parent bbeabe929b
commit 5b2496e522
2 changed files with 6 additions and 6 deletions

View file

@ -190,11 +190,7 @@ TEST_CASE(fixed_memory_read_only)
TRY_OR_FAIL(stream.seek(0));
ReadonlyBytes buffer { some_words.characters_without_null_termination(), some_words.length() };
EXPECT_CRASH("Write protection assert", [&] {
(void)stream.write_some(buffer);
return Test::Crash::Failure::DidNotCrash;
});
EXPECT(stream.write_some(buffer).is_error());
EXPECT_EQ(TRY_OR_FAIL(stream.tell()), 0ull);
EXPECT(!stream.is_eof());
}