Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop fd862aa80 -> c18b063db


imgmgr; allow replacing image with same version for non-active slot(s).


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/c18b063d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/c18b063d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/c18b063d

Branch: refs/heads/develop
Commit: c18b063db440a74c7f04fd055b4c576464b64824
Parents: fd862aa
Author: Marko Kiiskila <[email protected]>
Authored: Thu May 26 11:36:48 2016 -0700
Committer: Marko Kiiskila <[email protected]>
Committed: Thu May 26 11:36:48 2016 -0700

----------------------------------------------------------------------
 libs/imgmgr/src/imgmgr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c18b063d/libs/imgmgr/src/imgmgr.c
----------------------------------------------------------------------
diff --git a/libs/imgmgr/src/imgmgr.c b/libs/imgmgr/src/imgmgr.c
index 23c1dab..b7a31da 100644
--- a/libs/imgmgr/src/imgmgr.c
+++ b/libs/imgmgr/src/imgmgr.c
@@ -381,8 +381,13 @@ imgr_upload(struct nmgr_jbuf *njb)
             }
             if (rc == 0) {
                 if (!memcmp(&ver, &hdr->ih_ver, sizeof(ver))) {
-                    best = -1;
-                    break;
+                    if (active == i) {
+                        rc = NMGR_ERR_EINVAL;
+                        goto err;
+                    } else {
+                        best = i;
+                        break;
+                    }
                 }
                 /*
                  * Image in slot is ok.

Reply via email to