diff --git a/sys/kern/sys_sig.c b/sys/kern/sys_sig.c index 47b43fb35b45..558262e4fb90 100644 --- a/sys/kern/sys_sig.c +++ b/sys/kern/sys_sig.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_sig.c,v 1.31 2011/02/03 21:45:32 joerg Exp $ */ +/* $NetBSD: sys_sig.c,v 1.32 2011/03/03 20:46:16 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.31 2011/02/03 21:45:32 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.32 2011/03/03 20:46:16 martin Exp $"); #include #include @@ -223,20 +223,22 @@ kill1(struct lwp *l, pid_t pid, ksiginfo_t *ksi, register_t *retval) if ((u_int)ksi->ksi_signo >= NSIG) return EINVAL; - if (ksi->ksi_pid != l->l_proc->p_pid) - return EPERM; + if (pid != l->l_proc->p_pid) { + if (ksi->ksi_pid != l->l_proc->p_pid) + return EPERM; - if (ksi->ksi_uid != kauth_cred_geteuid(l->l_cred)) - return EPERM; + if (ksi->ksi_uid != kauth_cred_geteuid(l->l_cred)) + return EPERM; - switch (ksi->ksi_code) { - case SI_USER: - case SI_QUEUE: - break; - default: - return EPERM; + switch (ksi->ksi_code) { + case SI_USER: + case SI_QUEUE: + break; + default: + return EPERM; + } } - + if (pid > 0) { /* kill single process */ mutex_enter(proc_lock);