aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 75dd7d3..bf44faa 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -1098,6 +1098,15 @@ pthread_mutex::isGoodInitializerOrObject (pthread_mutex_t const *mutex)
return true;
}
+bool
+pthread_mutex::isGoodInitializerOrBadObject (pthread_mutex_t const *mutex)
+{
+ verifyable_object_state objectState = verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC, PTHREAD_MUTEX_INITIALIZER);
+ if (objectState == VALID_OBJECT)
+ return false;
+ return true;
+}
+
/* This is used for mutex creation protection within a single process only */
pthread_mutex::nativeMutex pthread_mutex::mutexInitializationLock NO_COPY;
@@ -2256,8 +2265,7 @@ pthread_mutex::init (pthread_mutex_t *mutex,
if (!mutexInitializationLock.lock ())
return EINVAL;
- /* FIXME: bugfix: we should check *mutex being a valid address */
- if (isGoodObject (mutex))
+ if (!isGoodInitializerOrBadObject (mutex))
{
mutexInitializationLock.unlock ();
return EBUSY;