From: Jong Hyuk Choi Date: Wed, 12 Mar 2003 16:37:04 +0000 (+0000) Subject: Error checking code for ITS#2367 X-Git-Tag: NO_SLAP_OP_BLOCKS~130 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c1da85eba083d598173ebad6bf2d4dfcd3aa459e;p=openldap Error checking code for ITS#2367 --- diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index 1454e18f93..0b38ae96b1 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -44,7 +44,7 @@ } \ } while ( 0 ) -static int +int bdb_idl_entry_cmp( const void *v_idl1, const void *v_idl2 ) { const bdb_idl_cache_entry_t *idl1 = v_idl1, *idl2 = v_idl2; @@ -493,8 +493,18 @@ bdb_idl_fetch_key( int i = 0; while ( bdb->bi_idl_lru_tail != NULL && i < 10 ) { ee = bdb->bi_idl_lru_tail; - avl_delete( &bdb->bi_idl_tree, (caddr_t) ee, - bdb_idl_entry_cmp ); + if ( avl_delete( &bdb->bi_idl_tree, (caddr_t) ee, + bdb_idl_entry_cmp ) == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( INDEX, ERR, + "bdb_idl_fetch_key: AVL delete failed\n", + 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: " + "AVL delete failed\n", + 0, 0, 0 ); +#endif + } IDL_LRU_DELETE( bdb, ee ); i++; --bdb->bi_idl_cache_size; @@ -551,8 +561,18 @@ bdb_idl_insert_key( matched_idl_entry = avl_find( bdb->bi_idl_tree, &idl_tmp, bdb_idl_entry_cmp ); if ( matched_idl_entry != NULL ) { - avl_delete( &bdb->bi_idl_tree, (caddr_t) matched_idl_entry, - bdb_idl_entry_cmp ); + if ( avl_delete( &bdb->bi_idl_tree, (caddr_t) matched_idl_entry, + bdb_idl_entry_cmp ) == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( INDEX, ERR, + "bdb_idl_fetch_key: AVL delete failed\n", + 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: " + "AVL delete failed\n", + 0, 0, 0 ); +#endif + } --bdb->bi_idl_cache_size; IDL_LRU_DELETE( bdb, matched_idl_entry ); free( matched_idl_entry->kstr.bv_val ); @@ -763,8 +783,18 @@ bdb_idl_delete_key( matched_idl_entry = avl_find( bdb->bi_idl_tree, &idl_tmp, bdb_idl_entry_cmp ); if ( matched_idl_entry != NULL ) { - avl_delete( &bdb->bi_idl_tree, (caddr_t) matched_idl_entry, - bdb_idl_entry_cmp ); + if ( avl_delete( &bdb->bi_idl_tree, (caddr_t) matched_idl_entry, + bdb_idl_entry_cmp ) == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( INDEX, ERR, + "bdb_idl_fetch_key: AVL delete failed\n", + 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, "=> bdb_idl_fetch_key: " + "AVL delete failed\n", + 0, 0, 0 ); +#endif + } --bdb->bi_idl_cache_size; IDL_LRU_DELETE( bdb, matched_idl_entry ); free( matched_idl_entry->kstr.bv_val );