mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 01:27:31 +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:
committed by
Tim Schumacher
parent
bbeabe929b
commit
5b2496e522
@@ -93,7 +93,11 @@ ErrorOr<size_t> FixedMemoryStream::seek(i64 offset, SeekMode seek_mode)
|
||||
|
||||
ErrorOr<size_t> FixedMemoryStream::write_some(ReadonlyBytes bytes)
|
||||
{
|
||||
VERIFY(m_writing_enabled);
|
||||
// MemoryStream isn't based on file-descriptors, but since most other
|
||||
// Stream implementations are, the interface specifies EBADF as the
|
||||
// "we don't support this particular operation" error code.
|
||||
if (!m_writing_enabled)
|
||||
return Error::from_errno(EBADF);
|
||||
|
||||
// FIXME: Can this not error?
|
||||
auto const nwritten = bytes.copy_trimmed_to(m_bytes.slice(m_offset));
|
||||
|
||||
Reference in New Issue
Block a user