Add ".tmp" to state and modified attributes temp files

refs #5124
This commit is contained in:
Alexander A. Klimov 2021-01-11 19:02:30 +01:00
parent 18c2dae941
commit 450b2117d2
2 changed files with 4 additions and 4 deletions

View File

@ -469,13 +469,13 @@ void ConfigObject::DumpObjects(const String& filename, int attributeTypes)
<< "Dumping program state to file '" << filename << "'";
try {
Utility::Glob(filename + ".*", &Utility::Remove, GlobFile);
Utility::Glob(filename + ".tmp.*", &Utility::Remove, GlobFile);
} catch (const std::exception& ex) {
Log(LogWarning, "ConfigObject") << DiagnosticInformation(ex);
}
std::fstream fp;
String tempFilename = Utility::CreateTempFile(filename + ".XXXXXX", 0600, fp);
String tempFilename = Utility::CreateTempFile(filename + ".tmp.XXXXXX", 0600, fp);
fp.exceptions(std::ofstream::failbit | std::ofstream::badbit);
if (!fp)

View File

@ -165,13 +165,13 @@ void IcingaApplication::DumpModifiedAttributes()
String path = Configuration::ModAttrPath;
try {
Utility::Glob(path + ".*", &Utility::Remove, GlobFile);
Utility::Glob(path + ".tmp.*", &Utility::Remove, GlobFile);
} catch (const std::exception& ex) {
Log(LogWarning, "IcingaApplication") << DiagnosticInformation(ex);
}
std::fstream fp;
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0644, fp);
String tempFilename = Utility::CreateTempFile(path + ".tmp.XXXXXX", 0644, fp);
fp.exceptions(std::ofstream::failbit | std::ofstream::badbit);
ConfigObject::Ptr previousObject;