Lay groundwork for Windows support

Move Unix-specific code to util-unix.cpp, and place Windows equivalents
in util-win32.cpp.  Most of the Windows functions are just stubs at
the moment, and we need a build system that works on Windows.
This commit is contained in:
Andrew Ayer
2014-06-08 16:03:18 -07:00
parent c2a9e48de5
commit 0774ed018c
8 changed files with 415 additions and 211 deletions

View File

@@ -33,6 +33,7 @@
#include "crypto.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdint.h>
#include <fstream>
#include <istream>
#include <ostream>
@@ -133,7 +134,7 @@ bool Key_file::load_from_file (const char* key_file_name)
bool Key_file::store_to_file (const char* key_file_name) const
{
mode_t old_umask = umask(0077); // make sure key file is protected
mode_t old_umask = umask(0077); // make sure key file is protected (TODO: Windows compat)
std::ofstream key_file_out(key_file_name, std::fstream::binary);
umask(old_umask);
if (!key_file_out) {