Skip to content

Commit

Permalink
revise shared group logic
Browse files Browse the repository at this point in the history
Signed-off-by: Yanfeng Liu <[email protected]>
  • Loading branch information
yf13 committed May 14, 2024
1 parent 7270ad8 commit 7a0f84d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sched/environ/env_dup.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int env_dup(FAR struct task_group_s *group, FAR char * const *envcp)

/* Is there an environment ? */

if (envcp != NULL)
if (envcp != NULL && group->tg_envp == NULL)
{
/* Pre-emption must be disabled throughout the following because the
* environment may be shared.
Expand Down
3 changes: 2 additions & 1 deletion sched/group/group_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,6 @@ void group_postinitialize(FAR struct task_tcb_s *tcb)
* task has exited.
*/

group->tg_pid = tcb->cmn.pid;
group->tg_pid = (group == &g_kthread_group) ? group->tg_pid :
tcb->cmn.pid;
}
3 changes: 2 additions & 1 deletion sched/group/group_setuptaskfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ int group_setuptaskfiles(FAR struct task_tcb_s *tcb,

/* Duplicate the parent task's file descriptors */

ret = files_duplist(&rtcb->group->tg_filelist,
ret = (group == rtcb->group) ? OK :
files_duplist(&rtcb->group->tg_filelist,
&group->tg_filelist, actions, cloexec);
if (ret >= 0 && actions != NULL)
{
Expand Down

0 comments on commit 7a0f84d

Please sign in to comment.