From f2d423e0847b4bb329d837ec0ce7db7152f09399 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 1 Feb 2005 05:37:09 +0000 Subject: [PATCH] ITS#3527 fix race in bdb_idl_cache_get --- servers/slapd/back-bdb/idl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index 29a337218d..038de21ef2 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -292,6 +292,7 @@ bdb_idl_cache_get( { bdb_idl_cache_entry_t idl_tmp; bdb_idl_cache_entry_t *matched_idl_entry; + int rc = LDAP_NO_SUCH_OBJECT; DBT2bv( key, &idl_tmp.kstr ); idl_tmp.db = db; @@ -301,19 +302,18 @@ bdb_idl_cache_get( if ( matched_idl_entry != NULL ) { if ( matched_idl_entry->idl && ids ) BDB_IDL_CPY( ids, matched_idl_entry->idl ); - ldap_pvt_thread_rdwr_runlock( &bdb->bi_idl_tree_rwlock ); ldap_pvt_thread_mutex_lock( &bdb->bi_idl_tree_lrulock ); IDL_LRU_DELETE( bdb, matched_idl_entry ); IDL_LRU_ADD( bdb, matched_idl_entry ); ldap_pvt_thread_mutex_unlock( &bdb->bi_idl_tree_lrulock ); if ( matched_idl_entry->idl ) - return LDAP_SUCCESS; + rc = LDAP_SUCCESS; else - return DB_NOTFOUND; + rc = DB_NOTFOUND; } ldap_pvt_thread_rdwr_runlock( &bdb->bi_idl_tree_rwlock ); - return LDAP_NO_SUCH_OBJECT; + return rc; } void -- 2.39.5