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

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

commit e0727715162d169ac81817d9d58cccf5f416579d
Author: buxiasen <buxia...@xiaomi.com>
AuthorDate: Sat Feb 22 18:28:57 2025 +0800

    binfmt/copyactions: fix comments, make the actions life cycle more clear
    
    Signed-off-by: buxiasen <buxia...@xiaomi.com>
---
 binfmt/binfmt.h             | 3 ++-
 binfmt/binfmt_copyactions.c | 8 +++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/binfmt/binfmt.h b/binfmt/binfmt.h
index a60d55318f..3cdf07ecbf 100644
--- a/binfmt/binfmt.h
+++ b/binfmt/binfmt.h
@@ -177,7 +177,8 @@ void binfmt_freeargv(FAR char * const *argv);
  *   do not have any real option other than to copy the callers action list.
  *
  * Input Parameters:
- *   copy     - Pointer of file actions
+ *   copy     - Pointer of the copied output file actions
+ *   actions  - Pointer of file actions to be copy
  *
  * Returned Value:
  *   A non-zero copy is returned on success.
diff --git a/binfmt/binfmt_copyactions.c b/binfmt/binfmt_copyactions.c
index 715dcbdc75..d1ed70b56d 100644
--- a/binfmt/binfmt_copyactions.c
+++ b/binfmt/binfmt_copyactions.c
@@ -52,7 +52,8 @@
  *   do not have any real option other than to copy the callers action list.
  *
  * Input Parameters:
- *   copy     - Pointer of file actions
+ *   copy     - Pointer of the copied output file actions
+ *   actions  - Pointer of file actions to be copy
  *
  * Returned Value:
  *   A non-zero copy is returned on success.
@@ -108,6 +109,11 @@ int binfmt_copyactions(FAR const 
posix_spawn_file_actions_t **copy,
       return -ENOMEM;
     }
 
+  /* We need to copy and re-organize the flink chain,  be care not modify
+   * the actions it self,  the prev have to point to the last time foreach
+   * item.
+   */
+
   for (entry = (FAR struct spawn_general_file_action_s *)actions,
        prev = NULL; entry != NULL; entry = entry->flink)
     {

Reply via email to