fcb; fix endless loop on corrupted FCB area.

Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/18298ea8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/18298ea8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/18298ea8

Branch: refs/heads/sterly_refactor
Commit: 18298ea80694fab5579773e585a122dccdddc6d5
Parents: 904ec76
Author: Marko Kiiskila <[email protected]>
Authored: Wed Aug 3 17:21:19 2016 -0700
Committer: Sterling Hughes <[email protected]>
Committed: Tue Aug 9 16:05:21 2016 -0700

----------------------------------------------------------------------
 sys/fcb/src/fcb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/18298ea8/sys/fcb/src/fcb.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb.c b/sys/fcb/src/fcb.c
index 2779575..fb85508 100644
--- a/sys/fcb/src/fcb.c
+++ b/sys/fcb/src/fcb.c
@@ -83,11 +83,15 @@ fcb_init(struct fcb *fcb)
     while (1) {
         rc = fcb_getnext_in_area(fcb, &fcb->f_active);
         if (rc == FCB_ERR_NOVAR) {
+            rc = FCB_OK;
+            break;
+        }
+        if (rc != 0) {
             break;
         }
     }
     os_mutex_init(&fcb->f_mtx);
-    return FCB_OK;
+    return rc;
 }
 
 int

Reply via email to