]> git.sur5r.net Git - openldap/commitdiff
cleanup
authorPierangelo Masarati <ando@openldap.org>
Sat, 6 Aug 2005 21:03:26 +0000 (21:03 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 6 Aug 2005 21:03:26 +0000 (21:03 +0000)
servers/slapd/back-monitor/backend.c
servers/slapd/back-monitor/cache.c
servers/slapd/back-monitor/init.c

index 30e4b08d23342e830c48e244e9ce9ed3ca5c06fb..10732fb4d9466fb0635274d2089a394f1b58e912 100644 (file)
@@ -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;
index d4c6292a6b0650c38203c71876e494f5f919456a..0ac86a5639c243a08072b07ecccf63ec955ae3a7 100644 (file)
@@ -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 );
 }
 
 /*
index f9a3482229aca00a14aea4a1f0c487ca7a4924ec..7be75a8276986414ecd13201262c249dec48e4ad 100644 (file)
@@ -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;
 }