This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new a59eb5ce1 nshlib: fix builtin_isavail() index 0 check
a59eb5ce1 is described below

commit a59eb5ce1adb6f56789bd9b5654a6ab1a30dfc5d
Author: zhaoyutao1 <[email protected]>
AuthorDate: Mon Aug 17 20:31:57 2026 +0800

    nshlib: fix builtin_isavail() index 0 check
    
    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 <[email protected]>
---
 nshlib/nsh_command.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index 8e136edc7..988e4792d 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -1274,7 +1274,7 @@ int nsh_command(FAR struct nsh_vtbl_s *vtbl, int argc, 
FAR char *argv[])
 
   index = builtin_isavail(cmd);
 
-  if (index > 0)
+  if (index >= 0)
     {
       /* Get the builtin structure by index */
 

Reply via email to