From: Howard Chu Date: Mon, 11 Jul 2005 10:27:59 +0000 (+0000) Subject: ITS#3824 remove env after slapadd/slapindex -q X-Git-Tag: OPENLDAP_AC_BP~425 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3d6fb1900634dbcbde77512522c9505f71baaee6;p=openldap ITS#3824 remove env after slapadd/slapindex -q --- diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index a2810c1eca..802319bbe0 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -605,6 +605,32 @@ bdb_db_close( BackendDB *be ) db_strerror(rc), rc, 0 ); return rc; } + +#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 2 + /* Delete the environment if we were in quick mode. This + * works around a bug in bdb4.2 that interferes with the + * operation of db_stat and other tools after a slapadd -q + * or slapindex -q has taken place. + */ + if( slapMode & SLAP_TOOL_QUICK ) { + rc = db_env_create( &bdb->bi_dbenv, 0 ); + if( rc != 0 ) { + Debug( LDAP_DEBUG_ANY, + "bdb_db_close: db_env_create failed: %s (%d)\n", + db_strerror(rc), rc, 0 ); + return rc; + } + rc = bdb->bi_dbenv->remove(bdb->bi_dbenv, bdb->bi_dbenv_home, + DB_FORCE); + bdb->bi_dbenv = NULL; + if( rc != 0 ) { + Debug( LDAP_DEBUG_ANY, + "bdb_db_close: dbenv_remove failed: %s (%d)\n", + db_strerror(rc), rc, 0 ); + return rc; + } + } +#endif } rc = alock_close( &bdb->bi_alock_info );