Author: kib
Date: Sat Feb  8 15:51:42 2014
New Revision: 261637
URL: http://svnweb.freebsd.org/changeset/base/261637

Log:
  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

Modified:
  stable/9/lib/libthr/thread/thr_kill.c
Directory Properties:
  stable/9/lib/libthr/   (props changed)

Modified: stable/9/lib/libthr/thread/thr_kill.c
==============================================================================
--- stable/9/lib/libthr/thread/thr_kill.c       Sat Feb  8 15:51:24 2014        
(r261636)
+++ stable/9/lib/libthr/thread/thr_kill.c       Sat Feb  8 15:51:42 2014        
(r261637)
@@ -42,24 +42,27 @@ __weak_reference(_pthread_kill, pthread_
 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);
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to