diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index b321d97..f7ac58b 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -104,7 +104,8 @@ proc_realparent(struct proc *child) sx_assert(&proctree_lock, SX_LOCKED); if ((child->p_treeflag & P_TREE_ORPHANED) == 0) { - return (child->p_pptr->p_pid == child->p_oppid ? + return (child->p_oppid == 0 || + child->p_pptr->p_pid == child->p_oppid ? child->p_pptr : initproc); } for (p = child; (p->p_treeflag & P_TREE_FIRST_ORPHAN) == 0;) {