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 1290acf35c23c45012c6ab3441b8fc342cc2b38f
Author: wangjianyu3 <[email protected]>
AuthorDate: Tue Dec 9 12:45:53 2025 +0800

    system/nxinit: Fix action event parsing loss
    
    init.rc
    
      on boot && property:sys.boot.reason!=bootloader
         echo "On boot, the reason is not BL."
    
    Before fixing
    
        init_main: action 0x40436120
        init_main:   sys.boot.reason!=bootloader
        init_main:   argv[0] 'echo'
        init_main:   argv[1] 'On boot, the reason is not BL.'
    
    After fixing
    
        init_main: action 0x40436120
        init_main:   sys.boot.reason!=bootloader
      + init_main:   default==boot
        init_main:   argv[0] 'echo'
        init_main:   argv[1] 'On boot, the reason is not BL.'
    
    Signed-off-by: wangjianyu3 <[email protected]>
---
 system/nxinit/action.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/system/nxinit/action.c b/system/nxinit/action.c
index b4bf03274..66c97d55d 100644
--- a/system/nxinit/action.c
+++ b/system/nxinit/action.c
@@ -397,15 +397,16 @@ int init_action_parse(FAR const struct parser_s *parser,
 
       while (--ret > 0)
         {
+          int n;
+
           if (!strncmp(argv[ret], ACTION_SECTION_PROP_PREFIX,
                        strlen(ACTION_SECTION_PROP_PREFIX)))
             {
-              ret = parse_event(argv[ret], a->events,
-                                nitems(a->events));
-              if (ret < 0)
+              n = parse_event(argv[ret], a->events, nitems(a->events));
+              if (n < 0)
                 {
                   free(a);
-                  return ret;
+                  return n;
                 }
             }
           else if (strncmp(argv[ret], ACTION_SECTION_AND_PREFIX,
@@ -414,12 +415,11 @@ int init_action_parse(FAR const struct parser_s *parser,
               char tmp[CONFIG_SYSTEM_NXINIT_RC_LINE_MAX];
 
               sprintf(tmp, ":%s=%s", ACTION_PROP_KEY_DEFAULT, argv[ret]);
-              ret = parse_event(tmp, a->events,
-                                nitems(a->events));
-              if (ret < 0)
+              n = parse_event(tmp, a->events, nitems(a->events));
+              if (n < 0)
                 {
                   free(a);
-                  return ret;
+                  return n;
                 }
 
               break;

Reply via email to