[Midnightbsd-cvs] src [6614] trunk/lib/libthr/thread/thr_kill.c: n _pthread_kill(), if passed pthread is current thread, do not send

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Mar 1 15:47:31 EST 2014


Revision: 6614
          http://svnweb.midnightbsd.org/src/?rev=6614
Author:   laffer1
Date:     2014-03-01 15:47:31 -0500 (Sat, 01 Mar 2014)
Log Message:
-----------
n _pthread_kill(), if passed pthread is current thread, do not send
the signal second time, by adding the missed else before if statement.

Obtained from:	FreeBSD

Modified Paths:
--------------
    trunk/lib/libthr/thread/thr_kill.c

Modified: trunk/lib/libthr/thread/thr_kill.c
===================================================================
--- trunk/lib/libthr/thread/thr_kill.c	2014-03-01 20:17:55 UTC (rev 6613)
+++ trunk/lib/libthr/thread/thr_kill.c	2014-03-01 20:47:31 UTC (rev 6614)
@@ -42,24 +42,27 @@
 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);



More information about the Midnightbsd-cvs mailing list