{
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"));
}
}
}
+
+ rename(tempFilename.CStr(), filename.CStr());
}
void DynamicObject::RestoreObjects(const String& filename)
}
void IcingaApplication::DumpProgramState(void) {
- String temp = GetStatePath() + ".tmp";
- DynamicObject::DumpObjects(temp);
- rename(temp.CStr(), GetStatePath().CStr());
+ DynamicObject::DumpObjects(GetStatePath());
}
IcingaApplication::Ptr IcingaApplication::GetInstance(void)