sched/posix_spawn: Don't insert name at the begin of argv

since the standard require the caller pass the name explicitly
https://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html:
The argument argv is an array of character pointers to null-terminated strings.
The last member of this array shall be a null pointer and is not counted in argc.
These strings constitute the argument list available to the new process image.
The value in argv[0] should point to a filename that is associated with the
process image being started by the posix_spawn() or posix_spawnp() function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2021-06-15 13:45:33 +08:00
committed by patacongo
parent 90f71bd017
commit bec68ad8ea
4 changed files with 18 additions and 31 deletions
+1 -6
View File
@@ -97,7 +97,6 @@ FAR struct task_tcb_s *nxtask_setup_vfork(start_t retaddr)
FAR struct task_tcb_s *parent;
FAR struct task_tcb_s *child;
FAR struct task_info_s *info;
FAR const char *name = NULL;
size_t stack_size;
uint8_t ttype;
int priority;
@@ -204,11 +203,7 @@ FAR struct task_tcb_s *nxtask_setup_vfork(start_t retaddr)
/* Setup to pass parameters to the new task */
#if CONFIG_TASK_NAME_SIZE > 0
name = parent->cmn.name;
#endif
nxtask_setup_arguments(child, name, parent->argv);
nxtask_setup_arguments(child, parent->argv[0], &parent->argv[1]);
/* Now we have enough in place that we can join the group */