summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-02-08 15:51:24 +0000
committerkib <kib@FreeBSD.org>2014-02-08 15:51:24 +0000
commit2adfb67dc93a1f063bfbc82a0ecd4234fc5b6028 (patch)
tree7ff440db96a7466956059a54aa798d54c3cf6b27 /lib/libthr
parent8f0b7f5c20a4692472456b9c4c253fe7e3903380 (diff)
downloadFreeBSD-src-2adfb67dc93a1f063bfbc82a0ecd4234fc5b6028.zip
FreeBSD-src-2adfb67dc93a1f063bfbc82a0ecd4234fc5b6028.tar.gz
MFC r261354:
In _pthread_kill(), if passed pthread is current thread, do not send the signal second time, by adding the missed else before if statement. PR: threads/186309
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_kill.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libthr/thread/thr_kill.c b/lib/libthr/thread/thr_kill.c
index b54458c58..8b0f683 100644
--- a/lib/libthr/thread/thr_kill.c
+++ b/lib/libthr/thread/thr_kill.c
@@ -42,24 +42,27 @@ __weak_reference(_pthread_kill, pthread_kill);
int
_pthread_kill(pthread_t pthread, int sig)
{
- struct pthread *curthread = _get_curthread();
+ struct pthread *curthread;
int ret;
/* Check for invalid signal numbers: */
if (sig < 0 || sig > _SIG_MAXSIG)
/* Invalid signal: */
- ret = EINVAL;
+ return (EINVAL);
+
+ curthread = _get_curthread();
+
/*
* Ensure the thread is in the list of active threads, and the
* signal is valid (signal 0 specifies error checking only) and
* not being ignored:
*/
- else if (curthread == pthread) {
+ if (curthread == pthread) {
if (sig > 0)
_thr_send_sig(pthread, sig);
ret = 0;
- } if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0))
- == 0) {
+ } else if ((ret = _thr_find_thread(curthread, pthread,
+ /*include dead*/0)) == 0) {
if (sig > 0)
_thr_send_sig(pthread, sig);
THR_THREAD_UNLOCK(curthread, pthread);
OpenPOWER on IntegriCloud