Fix #2260, Convert CFE_TBL_INFO_TABLE_LOCKED into a negative error code #2261
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
Describe the contribution
CFE_TBL_INFO_TABLE_LOCKED
inCFE_TBL_UpdateInternal()
converted into a negative error return code. Not updating the table is a clear failure, and it should not be represented by a positive return value, giving an impression of success.Testing performed
GitHub CI actions (incl. Code Coverage Analysis, Functional Test etc.) all passing successfully.
CFE_TBL_Update()
(which callsCFE_TBL_UpdateInternal()
) tests for(Status < 0)
which is now triggered byCFE_TBL_INFO_TABLE_LOCKED
as well, and the branch for a non-NULLRegRecPtr
was not previously covered. With these changes, that branch is now executed by the existing tests. This results in an increase in coverage of 2 lines and 1 branch:Expected behavior changes
Behavior of the function is the same. Only the return code in the case of trying to update a locked table is changing from positive to negative.
The only use of
CFE_TBL_Update()
from other apps where the return value is checked (e.g. in HK) use== CFE_SUCCESS
, so will not be affected by this change. Other (non-public) users who were checking the return ofCFE_TBL_Update()
and testing less precisely forreturn >= 0
(or similar equivalents) will see a change, but it seems unlikely that they would consider a non-update as success anyway.System(s) tested on
Intel(R) Celeron(R) N4100 CPU @ 1.10GHz x86_64
Debian GNU/Linux 11 (bullseye)
Current main branch of cFS.
Contributor Info
Avi Weiss @thnkslprpt