ref: 6a8ef22973600f28f54e58ab2ea9322a15cdd5b8
parent: f742164bc2191797c0b28c206d1b22db938ce202
author: ngkaho1234 <[email protected]>
date: Sun Oct 18 20:23:03 EDT 2015
FIX: ext4_fwrite cannot write to files correctly with filesize > 4.1G
--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -1457,8 +1457,8 @@
block_size = ext4_sb_get_block_size(&f->mp->fs.sb);
- sblock_end = (f->fpos + size) > f->fsize ? (f->fpos + size) : f->fsize;
- sblock_end /= block_size;
+ sblock_end = (f->fpos + size) / block_size;
+
file_blocks = (f->fsize / block_size);
if (f->fsize % block_size)