diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 80ef703b423c..ddeac6004b0b 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -523,6 +523,7 @@ interpret: len = min(ndp->ni_cnd.cn_namelen,MAXCOMLEN); bcopy(ndp->ni_cnd.cn_nameptr, p->p_comm, len); p->p_comm[len] = 0; + bcopy(p->p_comm, td->td_name, sizeof(td->td_name)); /* * mark as execed, wakeup the process that vforked (if any) and tell diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index cde764f3d5d3..bf6dec27164a 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -232,6 +232,7 @@ proc_linkup(struct proc *p, struct thread *td) /* XXX p_ksi may be null if ksiginfo zone is not ready */ p->p_ksi->ksi_flags = KSI_EXT | KSI_INS; } + bcopy(p->p_comm, td->td_name, sizeof(td->td_name)); LIST_INIT(&p->p_mqnotifier); p->p_numthreads = 0; thread_link(td, p);