diff options
| author | iamamyth <user@example.com> | 2024-12-27 16:04:11 -0800 |
|---|---|---|
| committer | iamamyth <user@example.com> | 2025-01-14 13:26:39 -0800 |
| commit | 36c5987156a31640c4638f1424b98285f6ea4a47 (patch) | |
| tree | 1e285008924b0f39bb54805d88a4417415bb214b /src/blockchain_db | |
| parent | 7fb0d2f48daf3de3ce1c0d28c4845a7c3dd97284 (diff) | |
| download | monzero-core-36c5987156a31640c4638f1424b98285f6ea4a47.tar.gz monzero-core-36c5987156a31640c4638f1424b98285f6ea4a47.tar.xz monzero-core-36c5987156a31640c4638f1424b98285f6ea4a47.zip | |
Fix get_database_size on Windows
Replace all calls to epee::file_io::get_file_size with
boost::filesystem::file_size in order to avoid lossy conversions from
paths to strings, which tend to break filename resolution. This commit
fixes a bug on Windows where the get_info RPC call reported a zero
database size because BlockchainLMBD::get_database_size returned zero.
Diffstat (limited to 'src/blockchain_db')
| -rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index f80013d02..f8ce38783 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -34,7 +34,6 @@ #include <cstring> // memcpy #include "string_tools.h" -#include "file_io_utils.h" #include "common/util.h" #include "common/pruning.h" #include "cryptonote_basic/cryptonote_format_utils.h" @@ -4500,12 +4499,11 @@ bool BlockchainLMDB::is_read_only() const uint64_t BlockchainLMDB::get_database_size() const { - uint64_t size = 0; boost::filesystem::path datafile(m_folder); datafile /= CRYPTONOTE_BLOCKCHAINDATA_FILENAME; - if (!epee::file_io_utils::get_file_size(datafile.string(), size)) - size = 0; - return size; + boost::system::error_code ec{}; + const boost::uintmax_t size = boost::filesystem::file_size(datafile, ec); + return (ec ? 0 : static_cast<uint64_t>(size)); } void BlockchainLMDB::fixup() |
