From: Jonathan McDowell Date: Tue, 14 Sep 2004 11:03:56 +0000 (+0000) Subject: Add more checking on db4 cleanup. X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/01ee2eab14a664ed2d72228f6f9bae6841b47726?hp=ed841dbf668ab9b92868064f0baada6c922322a8 Add more checking on db4 cleanup. Add more checking when cleaning up the db4 backend; some things might not have succeeded, but we should still try to cleanup those that did. --- diff --git a/keydb_db4.c b/keydb_db4.c index 899cd87..0d7b46b 100644 --- a/keydb_db4.c +++ b/keydb_db4.c @@ -224,17 +224,25 @@ void cleanupdb(void) { int i = 0; - dbenv->txn_checkpoint(dbenv, 0, 0, 0); - id32db->close(id32db, 0); - id32db = NULL; - worddb->close(worddb, 0); - worddb = NULL; - for (i = 0; i < numdbs; i++) { - dbconns[i]->close(dbconns[i], 0); - dbconns[i] = NULL; + if (dbenv != NULL) { + dbenv->txn_checkpoint(dbenv, 0, 0, 0); + if (id32db != NULL) { + id32db->close(id32db, 0); + id32db = NULL; + } + if (worddb != NULL) { + worddb->close(worddb, 0); + worddb = NULL; + } + for (i = 0; i < numdbs; i++) { + if (dbconns[i] != NULL) { + dbconns[i]->close(dbconns[i], 0); + dbconns[i] = NULL; + } + } + dbenv->close(dbenv, 0); + dbenv = NULL; } - dbenv->close(dbenv, 0); - dbenv = NULL; } /**