Fixed log message incorrectly referring to temp file.

This commit is contained in:
Gunnar Beutner 2012-08-07 14:17:36 +02:00
parent 21ea872651
commit 3c2acab7d7
2 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -208,9 +208,7 @@ int IcingaApplication::Main(const vector<String>& 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)