Merge pull request #508 from littlefs-project/fix-sanity-check
Moved sanity check in lfs_format after compaction
This commit is contained in:
@@ -3625,12 +3625,6 @@ static int lfs_rawformat(lfs_t *lfs, const struct lfs_config *cfg) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanity check that fetch works
|
|
||||||
err = lfs_dir_fetch(lfs, &root, (const lfs_block_t[2]){0, 1});
|
|
||||||
if (err) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
// force compaction to prevent accidentally mounting any
|
// force compaction to prevent accidentally mounting any
|
||||||
// older version of littlefs that may live on disk
|
// older version of littlefs that may live on disk
|
||||||
root.erased = false;
|
root.erased = false;
|
||||||
@@ -3638,6 +3632,12 @@ static int lfs_rawformat(lfs_t *lfs, const struct lfs_config *cfg) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sanity check that fetch works
|
||||||
|
err = lfs_dir_fetch(lfs, &root, (const lfs_block_t[2]){0, 1});
|
||||||
|
if (err) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|||||||
Reference in New Issue
Block a user