1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +00:00

TmpFS: Add ASSERT(offset >= 0) to read_bytes() and write_bytes()

This commit is contained in:
Andreas Kling 2020-01-07 15:25:56 +01:00
parent c48acafcba
commit a49d9c774f

View file

@ -155,6 +155,7 @@ ssize_t TmpFSInode::read_bytes(off_t offset, ssize_t size, u8* buffer, FileDescr
LOCKER(m_lock);
ASSERT(!is_directory());
ASSERT(size >= 0);
ASSERT(offset >= 0);
if (!m_content.has_value())
return 0;
@ -170,6 +171,7 @@ ssize_t TmpFSInode::write_bytes(off_t offset, ssize_t size, const u8* buffer, Fi
{
LOCKER(m_lock);
ASSERT(!is_directory());
ASSERT(offset >= 0);
off_t old_size = m_metadata.size;
off_t new_size = m_metadata.size;