From cbfac2fdccc83b04d9c2027e9e21070d4ac7c7e5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 May 2007 15:16:17 +0000 Subject: * Set a terminate() handler to ensure that we leave the BDB environment cleanly even when an exception is thrown from a destructor. We still crash, but we don't take all other Nix processes with us. --- src/libstore/local-store.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/libstore/local-store.cc') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 7b7efc84b3d1..cd8bc1a3394f 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -161,7 +161,11 @@ LocalStore::LocalStore(bool reserveSpace) LocalStore::~LocalStore() { /* If the database isn't open, this is a NOP. */ - nixDB.close(); + try { + nixDB.close(); + } catch (...) { + ignoreException(); + } } -- cgit 1.4.1