diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-27 17:14:27 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-27 17:14:27 +0200 |
commit | dde8d90747712d7bca65bf1471143a35bf71040d (patch) | |
tree | eb323965e013165bad1d4261a654cdfafce91fb6 /Kernel/FileSystem/Ext2FileSystem.cpp | |
parent | 100cb2a23720936369bf12bbc9d2ea59fa88f4fe (diff) | |
download | serenity-dde8d90747712d7bca65bf1471143a35bf71040d.zip |
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.
Diffstat (limited to 'Kernel/FileSystem/Ext2FileSystem.cpp')
-rw-r--r-- | Kernel/FileSystem/Ext2FileSystem.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index f8d161472c..94bf18226a 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -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); |