aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-09-14 22:22:43 +0200
committerRiccardo Spagni <ric@spagni.net>2018-09-14 22:22:43 +0200
commitbb30a7236725e456138f055f96a634c75ce2b491 (patch)
tree85f22f2d3069adc9dee0db210814e8ce6bbfe957
parentMerge pull request #4324 (diff)
parentblockchain_blackball: s/return false;/return 0;/ (diff)
downloadmonero-bb30a7236725e456138f055f96a634c75ce2b491.tar.xz
Merge pull request #4381
4cb1d879 blockchain_blackball: s/return false;/return 0;/ (moneromooo-monero) 9bdc9109 blockchain_blackball: use %zu for size_t (moneromooo-monero) db3db093 blockchain_blackball: use mdb_size_t where appropriate (moneromooo-monero) b1f05f58 blockchain_blackball: error out on fgets error (moneromooo-monero)
-rw-r--r--src/blockchain_utilities/blockchain_blackball.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/blockchain_utilities/blockchain_blackball.cpp b/src/blockchain_utilities/blockchain_blackball.cpp
index d9a179f64..1c6e54d10 100644
--- a/src/blockchain_utilities/blockchain_blackball.cpp
+++ b/src/blockchain_utilities/blockchain_blackball.cpp
@@ -558,7 +558,7 @@ static std::vector<output_data> get_spent_outputs(MDB_txn *txn)
int dbr = mdb_cursor_open(txn, dbi_spent, &cur);
CHECK_AND_ASSERT_THROW_MES(!dbr, "Failed to open cursor for spent outputs: " + std::string(mdb_strerror(dbr)));
MDB_val k, v;
- uint64_t count = 0;
+ mdb_size_t count = 0;
dbr = mdb_cursor_get(cur, &k, &v, MDB_FIRST);
if (dbr != MDB_NOTFOUND)
{
@@ -898,7 +898,11 @@ static std::vector<std::pair<uint64_t, uint64_t>> load_outputs(const std::string
while (1)
{
char s[256];
- fgets(s, sizeof(s), f);
+ if (!fgets(s, sizeof(s), f))
+ {
+ MERROR("Error reading from " << filename << ": " << strerror(errno));
+ break;
+ }
if (feof(f))
break;
const size_t len = strlen(s);
@@ -968,7 +972,7 @@ static bool export_spent_outputs(MDB_cursor *cur, const std::string &filename)
if (pending_offsets.size() == 1)
fprintf(f, "%" PRIu64 "\n", pending_offsets.front());
else
- fprintf(f, "%" PRIu64 "*%" PRIu64 "\n", pending_offsets.front(), pending_offsets.size());
+ fprintf(f, "%" PRIu64 "*%zu\n", pending_offsets.front(), pending_offsets.size());
pending_offsets.clear();
}
if (pending_amount != amount)
@@ -983,7 +987,7 @@ static bool export_spent_outputs(MDB_cursor *cur, const std::string &filename)
if (pending_offsets.size() == 1)
fprintf(f, "%" PRIu64 "\n", pending_offsets.front());
else
- fprintf(f, "%" PRIu64 "*%" PRIu64 "\n", pending_offsets.front(), pending_offsets.size());
+ fprintf(f, "%" PRIu64 "*%zu\n", pending_offsets.front(), pending_offsets.size());
pending_offsets.clear();
}
fclose(f);
@@ -1396,7 +1400,7 @@ int main(int argc, char* argv[])
if (stop_requested)
{
MINFO("Stopping secondary passes. Secondary passes are not incremental, they will re-run fully.");
- return false;
+ return 0;
}
}
if (!blackballs.empty())