about summary refs log tree commit diff
path: root/nptl/tst-cond25.c
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2015-02-15 17:33:31 +0100
committerTorvald Riegel <triegel@redhat.com>2015-02-16 18:11:14 +0100
commit35264d14426e1e3ca7b595db1de76208374b56e3 (patch)
tree84bf5dd295d459d78fc5f564d02b71c0ab22a01c /nptl/tst-cond25.c
parent6f49e32aa5c7c188b6b8e78a91636eb5ee2e1841 (diff)
downloadglibc-35264d14426e1e3ca7b595db1de76208374b56e3.tar.gz
glibc-35264d14426e1e3ca7b595db1de76208374b56e3.tar.xz
glibc-35264d14426e1e3ca7b595db1de76208374b56e3.zip
Make error checking effective in nptl/tst-cond25.c.
Diffstat (limited to 'nptl/tst-cond25.c')
-rw-r--r--nptl/tst-cond25.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/nptl/tst-cond25.c b/nptl/tst-cond25.c
index d80d8f7e76..be0bec484d 100644
--- a/nptl/tst-cond25.c
+++ b/nptl/tst-cond25.c
@@ -40,7 +40,15 @@ pthread_cond_t cond;
 
 void cleanup (void *u)
 {
-  /* pthread_cond_wait should always return with the mutex locked.  */
+  /* pthread_cond_wait should always return with the mutex locked.  The
+     pthread_mutex_unlock implementation does not actually check whether we
+     own the mutex for several mutex kinds, so check this explicitly.  */
+  int ret = pthread_mutex_trylock (&mutex);
+  if (ret != EDEADLK && ret != EBUSY)
+    {
+      printf ("mutex not locked in cleanup %d\n", ret);
+      abort ();
+    }
   if (pthread_mutex_unlock (&mutex))
     abort ();
 }