From 220e2782136f47edd3504b196659ade936b6846b Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 5 Mar 2014 20:23:44 -0500 Subject: [PATCH] Open database files using std::ios_base::binary in db_flatfile, which Windows can require --- modules/database/db_flatfile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp index f2545bd0b..694ff69a4 100644 --- a/modules/database/db_flatfile.cpp +++ b/modules/database/db_flatfile.cpp @@ -221,7 +221,7 @@ class DBFlatFile : public Module, public Pipe const Anope::string &db_name = Anope::DataDir + "/" + Config->GetModule(this)->Get("database", "anope.db"); - std::fstream fd(db_name.c_str(), std::ios_base::in); + std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary); if (!fd.is_open()) { Log(this) << "Unable to open " << db_name << " for reading!"; @@ -310,7 +310,7 @@ class DBFlatFile : public Module, public Pipe if (Anope::IsFile(db_name)) rename(db_name.c_str(), (db_name + ".tmp").c_str()); - std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream(db_name.c_str(), std::ios_base::out | std::ios_base::trunc); + std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream(db_name.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); if (!fs->is_open()) Log(this) << "Unable to open " << db_name << " for writing"; @@ -382,7 +382,7 @@ class DBFlatFile : public Module, public Pipe else db_name = Anope::DataDir + "/" + Config->GetModule(this)->Get("database", "anope.db"); - std::fstream fd(db_name.c_str(), std::ios_base::in); + std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary); if (!fd.is_open()) { Log(this) << "Unable to open " << db_name << " for reading!";