diff --git a/binfmt/binfmt_exec.c b/binfmt/binfmt_exec.c index 0dbd13b0ec..642eb4541d 100644 --- a/binfmt/binfmt_exec.c +++ b/binfmt/binfmt_exec.c @@ -138,9 +138,9 @@ static inline int binfmt_copyargv(FAR struct binary_s *bin, FAR char * const *ar /* Copy the argv list */ - binp->argv = (FAR char **)bin->argbuffer; - ptr = bin->argbuffer + argvsize; - for (; i < argv[i]; i++) + bin->argv = (FAR char **)bin->argbuffer; + ptr = bin->argbuffer + argvsize; + for (; argv[i]; i++) { bin->argv[i] = ptr; argsize = strlen(argv[i]) + 1; diff --git a/sched/task/task_vfork.c b/sched/task/task_vfork.c index 3b0ffad763..20e74179b1 100644 --- a/sched/task/task_vfork.c +++ b/sched/task/task_vfork.c @@ -116,7 +116,9 @@ static inline void vfork_namesetup(FAR struct tcb_s *parent, static inline int vfork_stackargsetup(FAR struct tcb_s *parent, FAR struct task_tcb_s *child) { - /* Is the parent a task? or a pthread? */ + /* Is the parent a task? or a pthread? Only tasks (and kernel threads) + * have command line arguments. + */ child->argv = NULL; if ((parent->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_PTHREAD) @@ -159,6 +161,8 @@ static inline int vfork_stackargsetup(FAR struct tcb_s *parent, child->argv[argc] = NULL; } + + return OK; } /****************************************************************************