summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_sig.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr/thread/thr_sig.c')
-rw-r--r--lib/libthr/thread/thr_sig.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c
index 0f7d173..efc6d5a 100644
--- a/lib/libthr/thread/thr_sig.c
+++ b/lib/libthr/thread/thr_sig.c
@@ -75,9 +75,22 @@ __weak_reference(_pthread_kill, pthread_kill);
int
_pthread_kill(pthread_t pthread, int sig)
{
+ int error;
+ if (sig < 0 || sig > NSIG)
+ return (EINVAL);
if (_thread_initial == NULL)
_thread_init();
+ error = _find_thread(pthread);
+ if (error != 0)
+ return (error);
+
+ /*
+ * A 0 signal means do error-checking but don't send signal.
+ */
+ if (sig == 0)
+ return (0);
+
return (thr_kill(pthread->thr_id, sig));
}
OpenPOWER on IntegriCloud