X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_mutex_unlock.c;h=6c4d7f22a041dce6d7e05b3f6f436888cc1a9e2d;hb=f58c8a0f391987a65e055ae591ec59b9df7b7f7c;hp=5855db0b588f613803b9000a86edfada657c7d08;hpb=02084109f0f0d6e0a7fe4a8cb3a90a422725e264;p=musl diff --git a/src/thread/pthread_mutex_unlock.c b/src/thread/pthread_mutex_unlock.c index 5855db0b..6c4d7f22 100644 --- a/src/thread/pthread_mutex_unlock.c +++ b/src/thread/pthread_mutex_unlock.c @@ -5,9 +5,11 @@ int pthread_mutex_unlock(pthread_mutex_t *m) pthread_t self; if (m->_m_type != PTHREAD_MUTEX_NORMAL) { + if (!m->_m_lock) + return EPERM; self = __pthread_self(); if ((m->_m_lock&0x1fffffff) != self->tid) - return EPERM; + return EPERM; if ((m->_m_type&3) == PTHREAD_MUTEX_RECURSIVE && --m->_m_count) return 0; if (m->_m_type >= 4) {