Ext2FS: Fix accidental zero-fill when appending to a file.
We were using the old file size, rather than the new file size, to determine how much to zero-fill in the last block of a file.
This commit is contained in:
parent
100cb2a237
commit
dde8d90747
Notes:
sideshowbarker
2024-07-19 14:34:26 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/dde8d907477
1 changed files with 1 additions and 1 deletions
|
@ -558,7 +558,7 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const byte* data,
|
|||
|
||||
int offset_into_first_block = offset % block_size;
|
||||
|
||||
int last_logical_block_index_in_file = size() / block_size;
|
||||
int last_logical_block_index_in_file = new_size / block_size;
|
||||
|
||||
ssize_t nwritten = 0;
|
||||
int remaining_count = min((off_t)count, (off_t)new_size - offset);
|
||||
|
|
Loading…
Add table
Reference in a new issue