Skip to content

nshlib: fix builtin_isavail() index 0 check under CONFIG_NSH_BUILTIN_AS_COMMAND - #3732

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
kanodayo1111:fix-builtin-index0
Aug 18, 2026
Merged

nshlib: fix builtin_isavail() index 0 check under CONFIG_NSH_BUILTIN_AS_COMMAND#3732
xiaoxiang781216 merged 1 commit into
apache:masterfrom
kanodayo1111:fix-builtin-index0

Conversation

@kanodayo1111

@kanodayo1111 kanodayo1111 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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.

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>
@jerpelea

Copy link
Copy Markdown
Contributor

please fill

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.

@xiaoxiang781216
xiaoxiang781216 merged commit a59eb5c into apache:master Aug 18, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants