From 47933921d05e2c40de9144ea6dbb136f34390da8 Mon Sep 17 00:00:00 2001 From: davidxu Date: Sat, 17 Jan 2004 03:09:57 +0000 Subject: Return EPERM if mutex owner is not current thread but it tries to unlock the mutex, old code confuses some programs when it returns EINVAL. Noticed by: bland --- lib/libpthread/thread/thr_mutex.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'lib/libpthread/thread/thr_mutex.c') diff --git a/lib/libpthread/thread/thr_mutex.c b/lib/libpthread/thread/thr_mutex.c index 464bc39..1232f33 100644 --- a/lib/libpthread/thread/thr_mutex.c +++ b/lib/libpthread/thread/thr_mutex.c @@ -1001,12 +1001,7 @@ mutex_unlock_common(pthread_mutex_t *m, int add_reference) * mutex: */ if ((*m)->m_owner != curthread) - /* - * Return an invalid argument error for no - * owner and a permission error otherwise: - */ - ret = (*m)->m_owner == NULL ? EINVAL : EPERM; - + ret = EPERM; else if (((*m)->m_type == PTHREAD_MUTEX_RECURSIVE) && ((*m)->m_count > 0)) /* Decrement the count: */ @@ -1039,12 +1034,7 @@ mutex_unlock_common(pthread_mutex_t *m, int add_reference) * mutex: */ if ((*m)->m_owner != curthread) - /* - * Return an invalid argument error for no - * owner and a permission error otherwise: - */ - ret = (*m)->m_owner == NULL ? EINVAL : EPERM; - + ret = EPERM; else if (((*m)->m_type == PTHREAD_MUTEX_RECURSIVE) && ((*m)->m_count > 0)) /* Decrement the count: */ @@ -1096,12 +1086,7 @@ mutex_unlock_common(pthread_mutex_t *m, int add_reference) * mutex: */ if ((*m)->m_owner != curthread) - /* - * Return an invalid argument error for no - * owner and a permission error otherwise: - */ - ret = (*m)->m_owner == NULL ? EINVAL : EPERM; - + ret = EPERM; else if (((*m)->m_type == PTHREAD_MUTEX_RECURSIVE) && ((*m)->m_count > 0)) /* Decrement the count: */ -- cgit v1.1