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

commit 247a8c03cb5d9f8d24b896ebe5b77b3b206a23a7
Author: wangjianyu3 <[email protected]>
AuthorDate: Tue Apr 21 14:54:30 2026 +0800

    system/nxinit: fix argument parser treating --option as -- separator
    
    The init_parse_arguments() function checked for '--' by only
    comparing the first two characters, causing options like --system,
    --nofork to be misinterpreted as the '--' argument separator. This
    truncated the remaining arguments. Add an isblank() check on the
    third character to ensure only standalone '--' followed by whitespace
    triggers the separator logic.
    
    Assisted-by: GitHubCopilot:claude-4.6-opus
    Signed-off-by: wangjianyu3 <[email protected]>
---
 system/nxinit/parser.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/system/nxinit/parser.c b/system/nxinit/parser.c
index e4c209598..7d8052110 100644
--- a/system/nxinit/parser.c
+++ b/system/nxinit/parser.c
@@ -60,7 +60,8 @@ int init_parse_arguments(FAR char *buf, bool dup, int argc, 
FAR char **argv)
           buf++;
         }
 
-      if (*buf == '-' && *(buf + 1) == '-')
+      if (*buf == '-' && *(buf + 1) == '-'
+          && (isblank(*(buf + 2)) || *(buf + 2) == '\0'))
         {
           argv[i++] = buf;
           if (i >= argc || *(buf += 2) == '\0')

Reply via email to