From 9dc1c429f747d4abedcc803792fbf537e3d5305c Mon Sep 17 00:00:00 2001 From: Some Random Crypto Guy Date: Wed, 5 Jun 2024 15:52:35 +0100 Subject: [PATCH 1/2] replaced the windows fixes back into the rebased code --- .../storages/portable_storage_val_converters.h | 1 + src/common/boost_serialization_helper.h | 3 ++- src/common/util.cpp | 18 ++++++++++++++++++ src/common/util.h | 2 ++ src/p2p/net_peerlist.cpp | 5 +++-- src/wallet/wallet2.cpp | 8 +++++--- 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/contrib/epee/include/storages/portable_storage_val_converters.h b/contrib/epee/include/storages/portable_storage_val_converters.h index 96b0c02..8c32481 100644 --- a/contrib/epee/include/storages/portable_storage_val_converters.h +++ b/contrib/epee/include/storages/portable_storage_val_converters.h @@ -36,6 +36,7 @@ #include "warnings.h" #include "misc_log_ex.h" +#include #include #include #include diff --git a/src/common/boost_serialization_helper.h b/src/common/boost_serialization_helper.h index 4a90310..cddd5d8 100644 --- a/src/common/boost_serialization_helper.h +++ b/src/common/boost_serialization_helper.h @@ -110,7 +110,8 @@ namespace tools catch(...) { // if failed, try reading in unportable mode - boost::filesystem::copy_file(file_path, file_path + ".unportable", boost::filesystem::copy_option::overwrite_if_exists); + //boost::filesystem::copy_file(file_path, file_path + ".unportable", boost::filesystem::copy_option::overwrite_if_exists); + tools::copy_file(file_path, file_path + ".unportable"); data_file.close(); data_file.open( file_path, std::ios_base::binary | std::ios_base::in); if(data_file.fail()) diff --git a/src/common/util.cpp b/src/common/util.cpp index 4b5e2ad..d5f35ea 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -115,6 +115,24 @@ static int flock_exnb(int fd) namespace tools { + + void copy_file(const std::string& from, const std::string& to) + { + using boost::filesystem::path; + #if BOOST_VERSION < 107400 + // Remove this preprocessor if/else when we are bumping the boost version. + boost::filesystem::copy_file( + path(from), + path(to), + boost::filesystem::copy_option::overwrite_if_exists); + #else + boost::filesystem::copy_file( + path(from), + path(to), + boost::filesystem::copy_options::overwrite_existing); + #endif + } + std::function signal_handler::m_handler; private_file::private_file() noexcept : m_handle(), m_filename() {} diff --git a/src/common/util.h b/src/common/util.h index f489594..138b901 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -67,6 +67,8 @@ namespace tools } }; + void copy_file(const std::string& from, const std::string& to); + //! A file restricted to process owner AND process. Deletes file on destruction. class private_file { std::unique_ptr m_handle; diff --git a/src/p2p/net_peerlist.cpp b/src/p2p/net_peerlist.cpp index 3e132c9..0ca3979 100644 --- a/src/p2p/net_peerlist.cpp +++ b/src/p2p/net_peerlist.cpp @@ -42,7 +42,7 @@ #include #include "net_peerlist_boost_serialization.h" - +#include "common/util.h" namespace nodetool { @@ -200,7 +200,8 @@ namespace nodetool if (!out) { // if failed, try reading in unportable mode - boost::filesystem::copy_file(path, path + ".unportable", boost::filesystem::copy_option::overwrite_if_exists); + //boost::filesystem::copy_file(path, path + ".unportable", boost::filesystem::copy_option::overwrite_if_exists); + tools::copy_file(path, path + ".unportable"); src_file.close(); src_file.open( path , std::ios_base::binary | std::ios_base::in); if(src_file.fail()) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 7506ea5..d033e5f 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -6425,8 +6425,9 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass catch (...) { LOG_PRINT_L0("Failed to open portable binary, trying unportable"); - if (use_fs) boost::filesystem::copy_file(m_wallet_file, m_wallet_file + ".unportable", boost::filesystem::copy_option::overwrite_if_exists); - std::stringstream iss; + //if (use_fs) boost::filesystem::copy_file(m_wallet_file, m_wallet_file + ".unportable", boost::filesystem::copy_option::overwrite_if_exists); + if (use_fs) tools::copy_file(m_wallet_file, m_wallet_file + ".unportable"); + std::stringstream iss; iss.str(""); iss << cache_data; boost::archive::binary_iarchive ar(iss); @@ -6447,7 +6448,8 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass catch (...) { LOG_PRINT_L0("Failed to open portable binary, trying unportable"); - if (use_fs) boost::filesystem::copy_file(m_wallet_file, m_wallet_file + ".unportable", boost::filesystem::copy_option::overwrite_if_exists); + //if (use_fs) boost::filesystem::copy_file(m_wallet_file, m_wallet_file + ".unportable", boost::filesystem::copy_option::overwrite_if_exists); + if (use_fs) tools::copy_file(m_wallet_file, m_wallet_file + ".unportable"); std::stringstream iss; iss.str(""); iss << cache_file_buf; From 078fa00bc5d8ff128e9d01e5d02c55b483c29cdc Mon Sep 17 00:00:00 2001 From: Some Random Crypto Guy Date: Wed, 5 Jun 2024 15:54:06 +0100 Subject: [PATCH 2/2] bumped version number --- README.md | 2 +- src/version.cpp.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fde0f2e..ead895a 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# Welcome to Fulmo \ No newline at end of file +# Welcome to Salvium \ No newline at end of file diff --git a/src/version.cpp.in b/src/version.cpp.in index 4833a17..0d6faa5 100644 --- a/src/version.cpp.in +++ b/src/version.cpp.in @@ -1,5 +1,5 @@ #define DEF_SALVIUM_VERSION_TAG "7f6b8da" -#define DEF_SALVIUM_VERSION "0.2.0" +#define DEF_SALVIUM_VERSION "0.2.1" #define DEF_MONERO_VERSION_TAG "@VERSIONTAG@" #define DEF_MONERO_VERSION "0.18.3.3" #define DEF_MONERO_RELEASE_NAME "Zero"