Closed nvlsianpu closed 6 years ago
Can you look at this @ccollins476ad @carlescufi
I think you should be returning MGMT_ERR_EBADSTATE
instead of MGMT_ERR_ENOMEM
.
Changed. I think here: https://github.com/apache/mynewt-mcumgr/pull/11/files#diff-265d4384c83b545f6d7e6837596331bcR295 the same error-code should be used. What do you think?
I think the second one actually makes a little sense semantically, because if there is no available slot it could be "no mem", but erasing "no mem" would be weirder, so makes more sense to say it cannot erase because of a bad state.
@utzig merge?
It was possible to erase slot 1 while it stores confirmed image while ongoing test run - this is unwanted behavior which allow to even brick remote device accidentally. This patch add check for such case of test run etc. This also aligns condition required for erase command execution to similar as upload command requires.
Signed-off-by: Andrzej Puzdrowski andrzej.puzdrowski@nordicsemi.no