From: Howard Chu Date: Thu, 17 Jan 2002 10:05:04 +0000 (+0000) Subject: In db_destroy, cannot checkpoint a NULL dbenv. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~94 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5c2bc277b82acf571713386197295ba9843caaa4;p=openldap In db_destroy, cannot checkpoint a NULL dbenv. --- diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index e08f0547d3..844575409e 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -346,18 +346,19 @@ bdb_db_destroy( BackendDB *be ) int rc; struct bdb_info *bdb = (struct bdb_info *) be->be_private; - /* force a checkpoint */ - if( bdb->bi_txn ) { - rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE ); - if( rc != 0 ) { - Debug( LDAP_DEBUG_ANY, - "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n", - db_strerror(rc), rc, 0 ); - } - } - /* close db environment */ if( bdb->bi_dbenv ) { + + /* force a checkpoint */ + if( bdb->bi_txn ) { + rc = TXN_CHECKPOINT( bdb->bi_dbenv, 0, 0, DB_FORCE ); + if( rc != 0 ) { + Debug( LDAP_DEBUG_ANY, + "bdb_db_destroy: txn_checkpoint failed: %s (%d)\n", + db_strerror(rc), rc, 0 ); + } + } + rc = bdb->bi_dbenv->close( bdb->bi_dbenv, 0 ); bdb->bi_dbenv = NULL; if( rc != 0 ) {