ITS#7996 Use a separate mutex in ldap_int_initialize

This commit is contained in:
Ondřej Kuzník 2019-06-21 12:19:38 +02:00
parent c06dc95cf9
commit b2f4cacd47

View file

@ -634,14 +634,14 @@ int ldap_int_stackguard;
void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
{
#ifdef LDAP_R_COMPILE
LDAP_PVT_MUTEX_FIRSTCREATE( gopts->ldo_mutex );
#endif
static ldap_pvt_thread_mutex_t init_mutex;
LDAP_PVT_MUTEX_FIRSTCREATE( init_mutex );
LDAP_MUTEX_LOCK( &gopts->ldo_mutex );
LDAP_MUTEX_LOCK( &init_mutex );
#endif
if ( gopts->ldo_valid == LDAP_INITIALIZED ) {
/* someone else got here first */
LDAP_MUTEX_UNLOCK( &gopts->ldo_mutex );
return;
goto done;
}
ldap_int_error_init();
@ -769,6 +769,8 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
openldap_ldap_init_w_env(gopts, NULL);
done:
LDAP_MUTEX_UNLOCK( &gopts->ldo_mutex );
done:;
#ifdef LDAP_R_COMPILE
LDAP_MUTEX_UNLOCK( &init_mutex );
#endif
}