nshlib: fix builtin_isavail() index 0 check under CONFIG_NSH_BUILTIN_AS_COMMAND - #3732
Merged
Merged
Conversation
builtin_isavail() returns 0-based index on success and negative errno on failure. The condition 'index > 0' incorrectly rejects valid index 0, making the first builtin app (index 0) unusable as an NSH command under CONFIG_NSH_BUILTIN_AS_COMMAND. Fix by changing to 'index >= 0'. Signed-off-by: zhaoyutao1 <zhaoyutao1@xiaomi.com>
xiaoxiang781216
approved these changes
Aug 18, 2026
JianyuWang0623
approved these changes
Aug 18, 2026
Contributor
|
please fill Testing Update this section with details on how did you verify the change, |
jerpelea
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
builtin_isavail() returns 0-based index on success and negative errno on failure. The condition 'index > 0' incorrectly rejects valid index 0, making the first builtin app (index 0) unusable as an NSH command under CONFIG_NSH_BUILTIN_AS_COMMAND.
Impact
Fix by changing to 'index >= 0'.
Testing
Update this section with details on how did you verify the change,
what Host was used for build (OS, CPU, compiler, ..), what Target was
used for verification (arch, board:config, ..), etc. Providing build
and runtime logs from before and after change is highly appreciated.