From: Gunnar Beutner Date: Tue, 7 Aug 2012 12:17:36 +0000 (+0200) Subject: Fixed log message incorrectly referring to temp file. X-Git-Tag: v0.0.1~153 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c2acab7d7ebf12947f31d9aac1a0fc0343620b0;p=icinga2 Fixed log message incorrectly referring to temp file. --- diff --git a/base/dynamicobject.cpp b/base/dynamicobject.cpp index 1995808ad..fd7c81316 100644 --- a/base/dynamicobject.cpp +++ b/base/dynamicobject.cpp @@ -352,8 +352,10 @@ void DynamicObject::DumpObjects(const String& filename) { Logger::Write(LogInformation, "base", "Dumping program state to file '" + filename + "'"); + String tempFilename = filename + ".tmp"; + ofstream fp; - fp.open(filename.CStr()); + fp.open(tempFilename.CStr()); if (!fp) throw_exception(runtime_error("Could not open '" + filename + "' file")); @@ -403,6 +405,8 @@ void DynamicObject::DumpObjects(const String& filename) } } } + + rename(tempFilename.CStr(), filename.CStr()); } void DynamicObject::RestoreObjects(const String& filename) diff --git a/icinga/icingaapplication.cpp b/icinga/icingaapplication.cpp index 37336d48f..937fd2473 100644 --- a/icinga/icingaapplication.cpp +++ b/icinga/icingaapplication.cpp @@ -208,9 +208,7 @@ int IcingaApplication::Main(const vector& args) } void IcingaApplication::DumpProgramState(void) { - String temp = GetStatePath() + ".tmp"; - DynamicObject::DumpObjects(temp); - rename(temp.CStr(), GetStatePath().CStr()); + DynamicObject::DumpObjects(GetStatePath()); } IcingaApplication::Ptr IcingaApplication::GetInstance(void)