From owner-freebsd-threads@FreeBSD.ORG Sat Feb 1 18:20:01 2014 Return-Path: Delivered-To: freebsd-threads@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A90765A for ; Sat, 1 Feb 2014 18:20:01 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5DFA11252 for ; Sat, 1 Feb 2014 18:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s11IK1qo018290 for ; Sat, 1 Feb 2014 18:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id s11IK1Au018289; Sat, 1 Feb 2014 18:20:01 GMT (envelope-from gnats) Date: Sat, 1 Feb 2014 18:20:01 GMT Message-Id: <201402011820.s11IK1Au018289@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org Cc: From: dfilter@FreeBSD.ORG (dfilter service) Subject: Re: threads/186309: commit references a PR X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: dfilter service List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Feb 2014 18:20:01 -0000 The following reply was made to PR threads/186309; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: threads/186309: commit references a PR Date: Sat, 1 Feb 2014 18:13:26 +0000 (UTC) Author: kib Date: Sat Feb 1 18:13:18 2014 New Revision: 261354 URL: http://svnweb.freebsd.org/changeset/base/261354 Log: In _pthread_kill(), if passed pthread is current thread, do not send the signal second time, by adding the missed else before if statement. While there, postpone initializing local curthread variable until passed signal number is checked for validity. Submitted by: John Wolfe PR: threads/186309 MFC after: 1 week Modified: head/lib/libthr/thread/thr_kill.c Modified: head/lib/libthr/thread/thr_kill.c ============================================================================== --- head/lib/libthr/thread/thr_kill.c Sat Feb 1 17:53:35 2014 (r261353) +++ head/lib/libthr/thread/thr_kill.c Sat Feb 1 18:13:18 2014 (r261354) @@ -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-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"