diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-05-01 15:16:17 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-05-01 15:16:17 +0000 |
commit | cbfac2fdccc83b04d9c2027e9e21070d4ac7c7e5 (patch) | |
tree | 9bff2f93fb123a3ad05bb3712e3d2a875c6da53b /src/libstore | |
parent | 644946feed146396c00c288337bad26428970aa4 (diff) |
* 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.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/build.cc | 4 | ||||
-rw-r--r-- | src/libstore/local-store.cc | 6 | ||||
-rw-r--r-- | src/libstore/remote-store.cc | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 7009876f1..5c8b31cf6 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -685,8 +685,8 @@ DerivationGoal::~DerivationGoal() try { killChild(); deleteTmpDir(false); - } catch (Error & e) { - printMsg(lvlError, format("error (ignored): %1%") % e.msg()); + } catch (...) { + ignoreException(); } } diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 7b7efc84b..cd8bc1a33 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(); + } } diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 1aab90d38..449a4c448 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -148,8 +148,8 @@ RemoteStore::~RemoteStore() fdSocket.close(); if (child != -1) child.wait(true); - } catch (Error & e) { - printMsg(lvlError, format("error (ignored): %1%") % e.msg()); + } catch (...) { + ignoreException(); } } |