$NetBSD: patch-ah,v 1.10 2012/10/13 11:47:19 adam Exp $ --- libraries/libldap/init.c.orig 2012-10-10 12:18:49.000000000 +0000 +++ libraries/libldap/init.c @@ -643,7 +643,11 @@ void ldap_int_initialize( struct ldapopt #if defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL) LDAP_MUTEX_LOCK( &ldap_int_hostname_mutex ); { - char *name = ldap_int_hostname; + char *name; +#if defined(LDAP_R_COMPILE) + ldap_pvt_thread_initialize(); +#endif + name = ldap_int_hostname; ldap_int_hostname = ldap_pvt_get_fqdn( name );