]> git.sur5r.net Git - openldap/commitdiff
Error checking code for ITS#2367
authorJong Hyuk Choi <jongchoi@openldap.org>
Wed, 12 Mar 2003 16:37:04 +0000 (16:37 +0000)
committerJong Hyuk Choi <jongchoi@openldap.org>
Wed, 12 Mar 2003 16:37:04 +0000 (16:37 +0000)
servers/slapd/back-bdb/idl.c

index 1454e18f93967a9112d8e025db9bec0c2d1274cb..0b38ae96b104882303e013b61ee92ebb026aa4c6 100644 (file)
@@ -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 );