aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-10 12:23:12 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-25 15:48:39 +0100
commit54cc209a5e0bb79682d50f7c5d492afb862415b6 (patch)
tree3c1a567f2b6ff7df6796fb401cc2d093c713d90a
parentwallet_rpc_server: init m_vm to NULL in ctor (diff)
downloadmonero-54cc209a5e0bb79682d50f7c5d492afb862415b6.tar.xz
wallet_rpc_server: catch failure to create directory
CID 175281
-rw-r--r--src/wallet/wallet_rpc_server.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index b46346028..6339ce241 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -27,6 +27,7 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
+#include <boost/format.hpp>
#include <boost/asio/ip/address.hpp>
#include <boost/filesystem/operations.hpp>
#include <cstdint>
@@ -153,7 +154,15 @@ namespace tools
#else
#define MKDIR(path, mode) mkdir(path, mode)
#endif
- MKDIR(m_wallet_dir.c_str(), 0700);
+ if (MKDIR(m_wallet_dir.c_str(), 0700) < 0)
+ {
+#ifdef _WIN32
+ LOG_ERROR(tr("Failed to create directory ") + m_wallet_dir);
+#else
+ LOG_ERROR((boost::format(tr("Failed to create directory %s: %s")) % m_wallet_dir % strerror(errno)).str());
+#endif
+ return false;
+ }
}
if (disable_auth)