diff options
author | des <des@FreeBSD.org> | 2001-11-02 23:50:00 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2001-11-02 23:50:00 +0000 |
commit | 84073a96d15842669bb7f01d421918949077c1ec (patch) | |
tree | f4095e8d7f53ba1d5a20e1245d74e9a7f6a0559b | |
parent | 2fd0cade3f0f371c3706aaa3efa962ecc9890efd (diff) | |
download | FreeBSD-src-84073a96d15842669bb7f01d421918949077c1ec.zip FreeBSD-src-84073a96d15842669bb7f01d421918949077c1ec.tar.gz |
We have a _SIG_VALID() macro, so use it instead of duplicating the test all
over the place. Also replace a printf() + panic() with a KASSERT().
Reviewed by: jhb
-rw-r--r-- | sys/kern/kern_sig.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 88a24fe..1edb766 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -219,7 +219,7 @@ do_sigaction(p, sig, act, oact, old) { register struct sigacts *ps; - if (sig <= 0 || sig > _SIG_MAXSIG) + if (!_SIG_VALID(sig)) return (EINVAL); PROC_LOCK(p); @@ -1053,7 +1053,7 @@ kill(td, uap) register struct proc *p; int error = 0; - if ((u_int)uap->signum > _SIG_MAXSIG) + if (!_SIG_VALID(uap->signum)) return (EINVAL); mtx_lock(&Giant); @@ -1105,7 +1105,7 @@ okillpg(td, uap) { int error; - if ((u_int)uap->signum > _SIG_MAXSIG) + if (!_SIG_VALID(uap->signum)) return (EINVAL); mtx_lock(&Giant); error = killpg1(td->td_proc, uap->signum, uap->pgid, 0); @@ -1220,10 +1220,8 @@ psignal(p, sig) struct thread *td; struct ksegrp *kg; - if (sig > _SIG_MAXSIG || sig <= 0) { - printf("psignal: signal %d\n", sig); - panic("psignal signal number"); - } + KASSERT(_SIG_VALID(sig), + ("psignal(): invalid signal %d\n", sig)); PROC_LOCK_ASSERT(p, MA_OWNED); KNOTE(&p->p_klist, NOTE_SIGNAL | sig); |