summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2013-12-09 15:25:16 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2013-12-09 19:50:55 -0600
commit327fbd6df749c64c9896b61cb7caa80db347df00 (patch)
tree3cd4147a2057eea3bb86a9425fae5b2a932a0e40 /cpukit/posix
parentpsignalimpl.h: Remove dead comment (diff)
downloadrtems-327fbd6df749c64c9896b61cb7caa80db347df00.tar.bz2
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.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/src/condwaitsupp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c
index a13d4f70f4..e5299075bc 100644
--- a/cpukit/posix/src/condwaitsupp.c
+++ b/cpukit/posix/src/condwaitsupp.c
@@ -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;