From 5c2bc277b82acf571713386197295ba9843caaa4 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 17 Jan 2002 10:05:04 +0000 Subject: [PATCH] In db_destroy, cannot checkpoint a NULL dbenv. --- servers/slapd/back-bdb/init.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 ) { -- 2.39.5