]> granicus.if.org Git - icinga2/commitdiff
Config sync: Open config files in binary mode
authorGunnar Beutner <gunnar@beutner.name>
Mon, 9 Feb 2015 06:44:45 +0000 (07:44 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 9 Feb 2015 06:44:45 +0000 (07:44 +0100)
fixes #8390

lib/remote/apilistener-sync.cpp

index 51120462be29c181431781a86707cb96a2d27018..ec76a16fb476d68eced38daa2aee597f096e05f3 100644 (file)
@@ -43,7 +43,7 @@ void ApiListener::ConfigGlobHandler(Dictionary::Ptr& config, const String& path,
        Log(LogNotice, "ApiListener")
            << "Creating config update for file '" << file << "'";
 
-       std::ifstream fp(file.CStr());
+       std::ifstream fp(file.CStr(), std::ifstream::binary);
        if (!fp)
                return;
 
@@ -81,7 +81,7 @@ bool ApiListener::UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictio
 
                        //pass the directory and generate a dir tree, if not existing already
                        Utility::MkDirP(Utility::DirName(path), 0755);
-                       std::ofstream fp(path.CStr(), std::ofstream::out | std::ostream::trunc);
+                       std::ofstream fp(path.CStr(), std::ofstream::out | std::ostream::binary | std::ostream::trunc);
                        fp << kv.second;
                        fp.close();
                }