gkostka / lwext4

ext2/ext3/ext4 filesystem library for microcontrollers
http://sourceforge.net/projects/lwext4/
Other
491 stars 128 forks source link

dir_idx: initialize entry inode before calculating csum #84

Closed osvunikernel closed 7 months ago

osvunikernel commented 7 months ago

When new directory is created and initialized (see ext4_link() and ext4_trunc_dir()), the csum is calculated before the inode is set to 0 and results in corrupt checksum. This affects only empty directories because as soon as new entries get added to a directory, the csum gets updated to new correct value.

This PR moves the setting of the inode before calculating the csum.