Skip to content

Commit

Permalink
binfmt/copyactions: fix comments, make the actions life cycle more clear
Browse files Browse the repository at this point in the history
Signed-off-by: buxiasen <[email protected]>
  • Loading branch information
jasonbu authored and anchao committed Feb 23, 2025
1 parent 0e5cb89 commit e072771
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion binfmt/binfmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion binfmt/binfmt_copyactions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit e072771

Please sign in to comment.