Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Sep 2014 11:25:10 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r271423 - stable/10/sys/kern
Message-ID:  <201409111125.s8BBPA5L074835@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409111125.s8BBPA5L074835>