Skip to content

Commit 4cd2bfc

Browse files
committed
Fixed inverted dir->count check logic
Curiously, the logic from 48bd2bf was incorrect, and would allow a commit to be tried if erased _or_ dir->count was at risk of overflow. That is clearly wrong, we should only try to commit if both conditions are met... Found again by dschendt
1 parent f24ff9f commit 4cd2bfc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2264,7 +2264,7 @@ static int lfs_dir_relocatingcommit(lfs_t *lfs, lfs_mdir_t *dir,
22642264
}
22652265
}
22662266

2267-
if (dir->erased || dir->count >= 0xff) {
2267+
if (dir->erased && dir->count < 0xff) {
22682268
// try to commit
22692269
struct lfs_commit commit = {
22702270
.block = dir->pair[0],

0 commit comments

Comments
 (0)