#include <fcntl.h>
#include "compat.h"
+#ifdef _WIN32
+#define OPENFLAGS O_RDWR|O_CREAT|_O_BINARY
+#else
+#define OPENFLAGS O_RDWR|O_CREAT
+#endif
+
using namespace p2tp;
peak_count_(0), hashes_(NULL), size_(0), sizek_(0),
complete_(0), completek_(0)
{
- fd_ = open(filename,O_RDWR|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+ fd_ = open(filename,OPENFLAGS,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (fd_<0)
return;
char hfn[1024] = "";
strcat(hfn, ".mhash");
} else
strcpy(hfn,hash_filename);
- hash_fd_ = open(hfn,O_RDWR|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+ hash_fd_ = open(hfn,OPENFLAGS,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (hash_fd_<0)
return;
if (root_hash_==Sha1Hash::ZERO) { // fresh submit, hash it
Import("libpath")
cpppath = env["CPPPATH"]
-if DEBUG:
+if DEBUG and sys.platform == "win32":
libs = ['p2tp','gtestd'] + libs # order is important, crypto needs to be last
else:
libs = ['p2tp','gtest'] + libs # order is important, crypto needs to be last