diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-09-27 15:01:56 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-09-27 17:28:50 +0000 |
commit | e67016ddb4d97400e4dfb7a8f2a37dc103d65cf4 (patch) | |
tree | ab585c5f83ea99555b879fcd8ff4b1794645f872 | |
parent | mlog: don't remove old logs if we failed to rename the current file (diff) | |
download | monero-e67016ddb4d97400e4dfb7a8f2a37dc103d65cf4.tar.xz |
blockchain_blackball: catch failure to commit db transaction
Coverity 188349
-rw-r--r-- | src/blockchain_utilities/blockchain_blackball.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/blockchain_utilities/blockchain_blackball.cpp b/src/blockchain_utilities/blockchain_blackball.cpp index 81c9bf705..5eb2acc79 100644 --- a/src/blockchain_utilities/blockchain_blackball.cpp +++ b/src/blockchain_utilities/blockchain_blackball.cpp @@ -401,7 +401,8 @@ static bool for_all_transactions(const std::string &filename, uint64_t &start_id } mdb_cursor_close(cur); - mdb_txn_commit(txn); + dbr = mdb_txn_commit(txn); + if (dbr) throw std::runtime_error("Failed to commit db transaction: " + std::string(mdb_strerror(dbr))); tx_active = false; mdb_dbi_close(env, dbi); mdb_env_close(env); @@ -471,7 +472,8 @@ static uint64_t find_first_diverging_transaction(const std::string &first_filena for (int i = 0; i < 2; ++i) { mdb_cursor_close(cur[i]); - mdb_txn_commit(txn[i]); + dbr = mdb_txn_commit(txn[i]); + if (dbr) throw std::runtime_error("Failed to query transaction: " + std::string(mdb_strerror(dbr))); tx_active[i] = false; mdb_dbi_close(env[i], dbi[i]); mdb_env_close(env[i]); |