Skip to content
Snippets Groups Projects
Commit 1133b215 authored by rsc's avatar rsc
Browse files

more defensive programming

parent f7017212
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment