xv6

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 1133b215d8ce5f72d2252cf19b81fc29289d0b38
parent f70172129c94e4d53b56fc10a7d859679b581bd2
Author: rsc <rsc>
Date:   Thu,  7 Sep 2006 01:56:22 +0000

more defensive programming

Diffstat:
Mproc.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/proc.c b/proc.c @@ -371,7 +371,9 @@ proc_wait(void) havekids = 0; for(i = 0; i < NPROC; i++){ p = &proc[i]; - if(p->state != UNUSED && p->ppid == cp->pid){ + if(p->state == UNUSED) + continue; + if(p->ppid == cp->pid){ if(p->state == ZOMBIE){ // Found one. kfree(p->mem, p->sz); @@ -379,6 +381,7 @@ proc_wait(void) pid = p->pid; p->state = UNUSED; p->pid = 0; + p->ppid = 0; release(&proc_table_lock); return pid; }