summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2020-11-30 17:00:36 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2020-11-30 17:00:36 +0000
commitec5fed758cbe1552c4716f2ac615d09a68905bca (patch)
tree95ecef6d9c3564962be020bf42162f08605685e2 /lib
parent991f23ef20d1cf3e55aea43cef576287a66d969e (diff)
downloadsrc-test2-ec5fed758cbe1552c4716f2ac615d09a68905bca.tar.gz
src-test2-ec5fed758cbe1552c4716f2ac615d09a68905bca.zip
Ensure that threading library is initialized in pthread_mutex_init().
We need at least thr_malloc ready. The situation is possible e.g. in case of libthr being listed in DT_NEEDED before some of its consumers. Reported and tested by: lev Sponsored by: The FreeBSD Foundation MFC after: 1 week
Notes
Notes: svn path=/head/; revision=368190
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_mutex.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 57984ef6d0e6..303386db7fe7 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -384,6 +384,8 @@ __Tthr_mutex_init(pthread_mutex_t * __restrict mutex,
struct pthread_mutex *pmtx;
int ret;
+ _thr_check_init();
+
if (mutex_attr != NULL) {
ret = mutex_check_attr(*mutex_attr);
if (ret != 0)