Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2020-12-22 09:06:51 +0300
committerChristopher Haster <chaster@utexas.edu>2020-12-22 20:47:48 +0300
commit2b804537b08dcb052a23d28fa4cb0805dca34ffc (patch)
treed188370f9d691c200643d431dfd775fb39094f98
parent1a59954ec64ca168828a15242cc6de94ac75f9d1 (diff)
Moved sanity check in lfs_format after compactionfix-sanity-check
After a bit of tweaking in 9dde5c7 to write out all superblocks during lfs_format, additional writes were added after the sanity checking normally done at the end. This turned out to be a problem when porting littlefs, as it makes it easy for addressing issues to not get caught during lfs_format. Found by marekr, tristanclare94, and mjs513
-rw-r--r--lfs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lfs.c b/lfs.c
index d7439fe..96c2d6e 100644
--- a/lfs.c
+++ b/lfs.c
@@ -3616,12 +3616,6 @@ static int lfs_rawformat(lfs_t *lfs, const struct lfs_config *cfg) {
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
// older version of littlefs that may live on disk
root.erased = false;
@@ -3629,6 +3623,12 @@ static int lfs_rawformat(lfs_t *lfs, const struct lfs_config *cfg) {
if (err) {
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: