]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Make error checking effective in nptl/tst-cond25.c.
authorTorvald Riegel <triegel@redhat.com>
Sun, 15 Feb 2015 16:33:31 +0000 (17:33 +0100)
committerTorvald Riegel <triegel@redhat.com>
Mon, 16 Feb 2015 17:11:14 +0000 (18:11 +0100)
ChangeLog
nptl/tst-cond25.c

index a0f0ae290dde637ebc8b26227ef7498a8a0b756b..78fe389f28ed679fe7060f00a306fabe3a5e1889 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-16  Torvald Riegel  <triegel@redhat.com>
+
+       * nptl/tst-cond25.c (cleanup): Explicitly check that the mutex is
+       acquired.
+
 2015-02-15  Matthew Fortune <Matthew.Fortune@imgtec.com>
 
        [BZ #17792]
index d80d8f7e7626d887ca996373eef64e9d69e83dd8..be0bec484d780c6544d46b5df5078787e9cc69f9 100644 (file)
@@ -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 ();
 }