git: Make pthread_*_destroy() more standards compliant

Michael Neumann mneumann at crater.dragonflybsd.org
Thu Jan 8 15:40:47 PST 2015


commit 146da5fcd4be3d6b3e74514ab38418637b600540
Author: Michael Neumann <mneumann at ntecs.de>
Date:   Fri Jan 9 00:40:06 2015 +0100

    Make pthread_*_destroy() more standards compliant
    
    Function pthread_{mutex,cond,rwlock}_destroy() returned EINVAL when the
    mutex/cond/rwlock was initialized statically via one of the
    PTHREAD_*_INITIALIZER macros and not being used before destruction. We now
    return success (0) instead, as it would have been the case when the *_init()
    function were used for initialization. This is also the behaviour Linux
    exhibits.
    
    Note that we now can no longer detect multiple calls to *_destroy(). Multiple
    calls will do no harm, but return success.
    
    While there, fix some potential null pointer derefs in cond and rwlock.
    
    Fixes: #2763

Summary of changes:
 lib/libthread_xu/thread/thr_cond.c   | 4 +++-
 lib/libthread_xu/thread/thr_mutex.c  | 4 +++-
 lib/libthread_xu/thread/thr_rwlock.c | 2 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/146da5fcd4be3d6b3e74514ab38418637b600540


-- 
DragonFly BSD source repository



More information about the Commits mailing list