diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 56f7895c8d4e..a992e64c9277 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -470,6 +470,7 @@ setpgid(td, uap) if (!inferior(targp)) { PROC_UNLOCK(targp); sx_sunlock(&proctree_lock); + error = ESRCH; goto fail; } sx_sunlock(&proctree_lock); @@ -529,6 +530,7 @@ setpgid(td, uap) PGRPSESS_XUNLOCK(); KASSERT(newpgrp != NULL, ("setpgid failed and newpgrp is null.")); + KASSERT(error != 0, ("setpgid successfully failed?")); FREE(newpgrp, M_PGRP); mtx_unlock(&Giant);