提交 b8688ff8 编写于 作者: R Rich Felker

fix crash if pthread_mutex_unlock is called without ever locking

this is valid for error-checking mutexes; otherwise it invokes UB and
would be justified in crashing.
上级 7fe58d35
......@@ -9,7 +9,7 @@ int pthread_mutex_unlock(pthread_mutex_t *m)
if (m->_m_type != PTHREAD_MUTEX_NORMAL) {
if (!m->_m_lock)
return EPERM;
self = __pthread_self();
self = pthread_self();
if ((m->_m_lock&0x1fffffff) != self->tid)
return EPERM;
if ((m->_m_type&3) == PTHREAD_MUTEX_RECURSIVE && m->_m_count)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册