Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1102, Correct return value bug in VxWorks OS_ShellOutputToFile_Impl #1390

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thnkslprpt
Copy link
Contributor

Checklist

Describe the contribution

  • Fixes Return OS_ERROR if OS_ObjectIdGetById fails in vxworks OS_ShellOutputToFile_Impl #1102
    • Corrects use of ReturnCode (instead of Return) to hold result of OS_OpenCreate()
    • Moves call to OS_ObjectIdGetById() out before the if to make code clearer (and remove the side-effect from the if condition)
    • Moves if (Result == OK) to inside the block, immediately after the one and only assignment to the Result variable (this check being outside that block was part of what caused the mixed-up OSAL/VxWorks returns previously)
    • Sets ReturnCode to OS_ERROR if shellGenericInit() does not return OK - thus correcting the behavior of the function (and the coverage test) to actually return an error if that call fails
    • Updated the coverage test return value from OS_SUCCESS to OS_ERROR when OS_ObjectIdGetById() is seeded with an error return

Testing performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Coverage Tests etc.).

Expected behavior changes
OS_ShellOutputToFile_Impl() will actually return an error on all failure cases now.
Function logic and flow is clearer now - easing future maintenance.

Contributor Info
Avi Weiss @thnkslprpt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return OS_ERROR if OS_ObjectIdGetById fails in vxworks OS_ShellOutputToFile_Impl
1 participant