svn commit: r271423 - stable/10/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu Sep 11 11:25:11 UTC 2014


Author: kib
Date: Thu Sep 11 11:25:10 2014
New Revision: 271423
URL: http://svnweb.freebsd.org/changeset/base/271423

Log:
  MFC r270993 (by mjg):
  Fix up proc_realparent to always return correct process.
  
  Approved by:	re (delphij)

Modified:
  stable/10/sys/kern/kern_exit.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_exit.c
==============================================================================
--- stable/10/sys/kern/kern_exit.c	Thu Sep 11 10:53:57 2014	(r271422)
+++ stable/10/sys/kern/kern_exit.c	Thu Sep 11 11:25:10 2014	(r271423)
@@ -106,8 +106,12 @@ 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 ?
-		    child->p_pptr : initproc);
+		if (child->p_oppid == 0 ||
+		    child->p_pptr->p_pid == child->p_oppid)
+			parent = child->p_pptr;
+		else
+			parent = initproc;
+		return (parent);
 	}
 	for (p = child; (p->p_treeflag & P_TREE_FIRST_ORPHAN) == 0;) {
 		/* Cannot use LIST_PREV(), since the list head is not known. */


More information about the svn-src-all mailing list