From: Torvald Riegel Date: Sun, 15 Feb 2015 16:33:31 +0000 (+0100) Subject: Make error checking effective in nptl/tst-cond25.c. X-Git-Tag: glibc-2.22~591 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35264d14426e1e3ca7b595db1de76208374b56e3;p=thirdparty%2Fglibc.git Make error checking effective in nptl/tst-cond25.c. --- diff --git a/ChangeLog b/ChangeLog index a0f0ae290dd..78fe389f28e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-02-16 Torvald Riegel + + * nptl/tst-cond25.c (cleanup): Explicitly check that the mutex is + acquired. + 2015-02-15 Matthew Fortune [BZ #17792] diff --git a/nptl/tst-cond25.c b/nptl/tst-cond25.c index d80d8f7e762..be0bec484d7 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 (); }