From: kettenis Date: Wed, 26 Oct 2022 13:31:06 +0000 (+0000) Subject: Fix handling of PGIDs in wait4(2) that I broke with the previous commit. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ddb514ca016cb1a2d62dcd3156f0baac624f22fd;p=openbsd Fix handling of PGIDs in wait4(2) that I broke with the previous commit. ok anton@, millert@ --- diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index b14a0350b2b..a298ba55747 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.205 2022/10/25 16:08:26 kettenis Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.206 2022/10/26 13:31:06 kettenis Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -639,10 +639,13 @@ sys_wait4(struct proc *q, void *v, register_t *retval) if (SCARG(uap, pid) == WAIT_MYPGRP) { idtype = P_PGID; - id = -q->p_p->ps_pgid; + id = q->p_p->ps_pgid; } else if (SCARG(uap, pid) == WAIT_ANY) { idtype = P_ALL; id = 0; + } else if (pid < 0) { + idtype = P_PGID; + id = -pid; } else { idtype = P_PID; id = pid;