condwaitsupp.c: Return EPERM if waiting and mutex is not locked

This error check was commented out because it is not in the POSIX
specification. However, the GNU/Linux manual page does document
that EPERM is to be returned in this situation.
This commit is contained in:
Joel Sherrill
2013-12-09 15:25:16 -06:00
parent 96281908a2
commit 327fbd6df7

View File

@@ -58,13 +58,17 @@ int _POSIX_Condition_variables_Wait_support(
return EINVAL;
}
(void) pthread_mutex_unlock( mutex );
/* XXX ignore this for now since behavior is undefined
mutex_status = pthread_mutex_unlock( mutex );
/*
* Historically, we ignored the return code since the behavior
* is undefined by POSIX. But GNU/Linux returns EPERM in this
* case, so we follow their lead.
*/
if ( mutex_status ) {
_Objects_Put( &the_cond->Object );
return EINVAL;
return EPERM;
}
*/
if ( !already_timedout ) {
the_cond->Mutex = *mutex;