This is needed as thread sanatizer also overloads pthread_create and
pthread_exit().
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
case UWRAP_LIBPTHREAD:
handle = uwrap.libpthread.handle;
if (handle == NULL) {
+#ifdef RTLD_NEXT
+ /*
+ * Because thread sanatizer also overloads
+ * pthread_create() and pthread_exit() we need use
+ * RTLD_NEXT instead of libpthread.so.0
+ */
+ handle = uwrap.libpthread.handle = RTLD_NEXT;
+#else
handle = dlopen("libpthread.so.0", flags);
+#endif
if (handle != NULL) {
break;
}