bdb->bi_databases[i] = db;
}
+ /* get nextid */
+ rc = bdb_last_id( be, NULL );
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "bdb_db_open: last_id(%s) failed: %s (%d)\n",
+ bdb->bi_dbenv_home, db_strerror(rc), rc );
+ return rc;
+ }
+
+
/* <insert> open (and create) index databases */
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
/* close db environment */
- rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
- bdb->bi_dbenv = NULL;
- if( rc != 0 ) {
- Debug( LDAP_DEBUG_ANY,
- "bdb_db_destroy: close failed: %s (%d)\n",
- db_strerror(rc), rc, 0 );
- return rc;
+ if( bdb->bi_dbenv ) {
+ rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 );
+ bdb->bi_dbenv = NULL;
+ if( rc != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "bdb_db_destroy: close failed: %s (%d)\n",
+ db_strerror(rc), rc, 0 );
+ return rc;
+ }
}
return 0;