waitpid: fix deadlock

This commit is contained in:
Matheus
2022-10-16 18:52:34 -03:00
parent 5a31ba1b4f
commit 785ac0d486
+2 -2
View File
@@ -51,13 +51,13 @@ syscallret syscall_waitpid(pid_t pid, int *status, int options){
sibling = NULL; sibling = NULL;
while(child){ while(child){
if(pid > 0 && child->pid != pid)
continue;
if(child->state == PROC_STATE_ZOMBIE){ if(child->state == PROC_STATE_ZOMBIE){
if((pid > 0 && child->pid == pid) || pid == 0){
loop = false; loop = false;
break; break;
} }
}
if(child->sibling) if(child->sibling)
sibling = child; sibling = child;