aboutsummaryrefslogtreecommitdiff
path: root/src/common/boost_serialization_helper.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2016-12-16 18:08:24 -0500
committerLee Clagett <code@leeclagett.com>2016-12-16 23:59:46 -0500
commit427054c3d50198dff65b5e003165b1f564ebd26f (patch)
tree185a13198aa77320c1b5220497f27366ecbb3465 /src/common/boost_serialization_helper.h
parentMerge pull request #1459 (diff)
downloadmonero-427054c3d50198dff65b5e003165b1f564ebd26f.tar.xz
Enabled HTTP auth support for monero-wallet-rpc
Diffstat (limited to 'src/common/boost_serialization_helper.h')
-rw-r--r--src/common/boost_serialization_helper.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/common/boost_serialization_helper.h b/src/common/boost_serialization_helper.h
index c640a1705..bf0023471 100644
--- a/src/common/boost_serialization_helper.h
+++ b/src/common/boost_serialization_helper.h
@@ -53,8 +53,8 @@ namespace tools
return false;
}
- FILE* data_file_file = _fdopen(data_file_descriptor, "wb");
- if (0 == data_file_file)
+ const std::unique_ptr<FILE, tools::close_file> data_file_file{_fdopen(data_file_descriptor, "wb")};
+ if (nullptr == data_file_file)
{
// Call CloseHandle is not necessary
_close(data_file_descriptor);
@@ -62,11 +62,10 @@ namespace tools
}
// HACK: undocumented constructor, this code may not compile
- std::ofstream data_file(data_file_file);
+ std::ofstream data_file(data_file_file.get());
if (data_file.fail())
{
// Call CloseHandle and _close are not necessary
- fclose(data_file_file);
return false;
}
#else
@@ -85,7 +84,6 @@ namespace tools
#if defined(_MSC_VER)
// To make sure the file is fully stored on disk
::FlushFileBuffers(data_file_handle);
- fclose(data_file_file);
#endif
return true;