diff options
author | luigi1111 <luigi1111w@gmail.com> | 2019-09-30 18:43:48 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2019-09-30 18:43:48 -0500 |
commit | c6430f9dd06df45ed68e603bc81b385e1d19f4a0 (patch) | |
tree | 074baf2a0a32e50cfe8a0fd5507812be39d86fbd /src/wallet/wallet2.cpp | |
parent | Merge pull request #5653 (diff) | |
parent | epee: abstract_tcp_server2: resolve CID 203919 (DC.WEAK_CRYPTO) (diff) | |
download | monero-c6430f9dd06df45ed68e603bc81b385e1d19f4a0.tar.xz |
Merge pull request #5893
Coverity fixes [3a81639, 1bd962d, 2825f07, d099658, d46f701, cd57a10] (anonimal)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index b85e805de..3e00369a8 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -13195,6 +13195,12 @@ bool wallet2::save_to_file(const std::string& path_to_file, const std::string& r } FILE *fp = fopen(path_to_file.c_str(), "w+"); + if (!fp) + { + MERROR("Failed to open wallet file for writing: " << path_to_file << ": " << strerror(errno)); + return false; + } + // Save the result b/c we need to close the fp before returning success/failure. int write_result = PEM_write(fp, ASCII_OUTPUT_MAGIC.c_str(), "", (const unsigned char *) raw.c_str(), raw.length()); fclose(fp); |