From 6c49a8e295def754c6d902ca8563cce6571cfbf3 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 4 May 2001 18:13:11 +0000 Subject: [PATCH] Fix a bug in the pfind() changes due to confusing the process returned by pfind() ('pp') with the process being detached from ptrace. Reported by: bde --- sys/kern/sys_process.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index d08f342723e7..03640cf6e11d 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -381,7 +381,12 @@ ptrace(curp, uap) struct proc *pp; pp = pfind(p->p_oppid); - proc_reparent(p, pp ? pp : initproc); + if (pp != NULL) + PROC_UNLOCK(pp); + else + pp = initproc; + PROC_LOCK(p); + proc_reparent(p, pp); } else PROC_LOCK(p); p->p_flag &= ~(P_TRACED | P_WAITED);