make it compile and make it secure files

pull/664/head
Jeff Becker 5 years ago
parent ba6f9ed2d7
commit b178aa1a36
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -150,7 +150,7 @@ struct llarp_nodedb
SaveAll() LOCKS_EXCLUDED(access);
void
AsyncFlushToDisk()
AsyncFlushToDisk();
};
/// struct for async rc verification

@ -3,6 +3,7 @@
#include <util/buffer.hpp>
#include <util/bencode.h>
#include <util/fs.hpp>
#include <util/logger.hpp>
#include <util/mem.hpp>
@ -356,8 +357,12 @@ namespace llarp
return false;
buf.sz = buf.cur - buf.base;
{
std::ofstream f;
f.open(fpath);
const fs::path path = std::string(fpath);
auto optional_f =
llarp::util::OpenFileStream< std::ofstream >(path, std::ios::binary);
if(!optional_f)
return false;
auto& f = optional_f.value();
if(!f.is_open())
return false;
f.write((char*)buf.base, buf.sz);

Loading…
Cancel
Save