From: Pierangelo Masarati Date: Sat, 6 Aug 2005 21:03:26 +0000 (+0000) Subject: cleanup X-Git-Tag: OPENLDAP_AC_BP~90 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=47d39181d6443acf31f55723a1717ce805234775;p=openldap cleanup --- diff --git a/servers/slapd/back-monitor/backend.c b/servers/slapd/back-monitor/backend.c index 30e4b08d23..10732fb4d9 100644 --- a/servers/slapd/back-monitor/backend.c +++ b/servers/slapd/back-monitor/backend.c @@ -57,8 +57,7 @@ monitor_subsys_backend_init( return -1; } - if ( monitor_cache_get( mi, &ms->mss_ndn, &e_backend ) ) - { + if ( monitor_cache_get( mi, &ms->mss_ndn, &e_backend ) ) { Debug( LDAP_DEBUG_ANY, "monitor_subsys_backend_init: " "unable to get entry \"%s\"\n", @@ -73,7 +72,7 @@ monitor_subsys_backend_init( i = -1; LDAP_STAILQ_FOREACH( bi, &backendInfo, bi_next ) { char buf[ BACKMONITOR_BUFSIZE ]; - BackendDB *be; + BackendDB *be; struct berval bv; int j; Entry *e; diff --git a/servers/slapd/back-monitor/cache.c b/servers/slapd/back-monitor/cache.c index d4c6292a6b..0ac86a5639 100644 --- a/servers/slapd/back-monitor/cache.c +++ b/servers/slapd/back-monitor/cache.c @@ -136,6 +136,8 @@ monitor_cache_get( assert( ndn != NULL ); assert( ep != NULL ); + *ep = NULL; + tmp_mc.mc_ndn = *ndn; ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex ); mc = ( monitor_cache_t * )avl_find( mi->mi_cache, @@ -144,16 +146,12 @@ monitor_cache_get( if ( mc != NULL ) { /* entry is returned with mutex locked */ monitor_cache_lock( mc->mc_e ); - ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex ); *ep = mc->mc_e; - - return( 0 ); } - + ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex ); - *ep = NULL; - return( -1 ); + return ( *ep == NULL ? -1 : 0 ); } /* diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index f9a3482229..7be75a8276 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -1366,7 +1366,6 @@ int monitor_back_db_init( BackendDB *be ) { - monitor_info_t *mi; int rc; struct berval dn, ndn; struct berval bv; @@ -1390,8 +1389,8 @@ monitor_back_db_init( rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, NULL ); if( rc != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_ANY, - "unable to normalize monitor DN \"%s\"\n", - SLAPD_MONITOR_DN, 0, 0 ); + "unable to normalize monitor DN \"%s\" (%d)\n", + dn.bv_val, rc, 0 ); return -1; } @@ -1401,11 +1400,9 @@ monitor_back_db_init( /* NOTE: only one monitor database is allowed, * so we use static storage */ - mi = &monitor_info; - - ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex ); + ldap_pvt_thread_mutex_init( &monitor_info.mi_cache_mutex ); - be->be_private = mi; + be->be_private = &monitor_info; return 0; }