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

Ext2FS: Propagate I/O errors from Ext2FSInode::write_bytes()

This commit is contained in:
Andreas Kling 2021-01-20 23:51:14 +01:00
parent 65570216b4
commit 1f53dd0943

View file

@ -918,11 +918,10 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const UserOrKernel
#ifdef EXT2_VERY_DEBUG #ifdef EXT2_VERY_DEBUG
dbgln("Ext2FS: Writing block {} (offset_into_block: {})", m_block_list[bi], offset_into_block); dbgln("Ext2FS: Writing block {} (offset_into_block: {})", m_block_list[bi], offset_into_block);
#endif #endif
int err = fs().write_block(m_block_list[bi], data.offset(nwritten), num_bytes_to_copy, offset_into_block, allow_cache); auto result = fs().write_block(m_block_list[bi], data.offset(nwritten), num_bytes_to_copy, offset_into_block, allow_cache);
if (err < 0) { if (result.is_error()) {
dbgln("Ext2FS: write_block({}) failed (bi: {})", m_block_list[bi], bi); dbgln("Ext2FS: write_block({}) failed (bi: {})", m_block_list[bi], bi);
ASSERT_NOT_REACHED(); return result;
return err;
} }
remaining_count -= num_bytes_to_copy; remaining_count -= num_bytes_to_copy;
nwritten += num_bytes_to_copy; nwritten += num_bytes_to_copy;