mirror of https://github.com/Icinga/icinga2.git
Handle I/O errors while writing the Icinga state file more gracefully
fixes #12334
This commit is contained in:
parent
1aac54f4bb
commit
4c7e2994a7
|
@ -487,6 +487,7 @@ void ConfigObject::DumpObjects(const String& filename, int attributeTypes)
|
|||
|
||||
std::fstream fp;
|
||||
String tempFilename = Utility::CreateTempFile(filename + ".XXXXXX", 0600, fp);
|
||||
fp.exceptions(std::ofstream::failbit | std::ofstream::badbit);
|
||||
|
||||
if (!fp)
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Could not open '" + tempFilename + "' file"));
|
||||
|
|
|
@ -176,6 +176,7 @@ void IcingaApplication::DumpModifiedAttributes(void)
|
|||
|
||||
std::fstream fp;
|
||||
String tempFilename = Utility::CreateTempFile(path + ".XXXXXX", 0644, fp);
|
||||
fp.exceptions(std::ofstream::failbit | std::ofstream::badbit);
|
||||
|
||||
ConfigObject::Ptr previousObject;
|
||||
ConfigObject::DumpModifiedAttributes(boost::bind(&PersistModAttrHelper, boost::ref(fp), boost::ref(previousObject), _1, _2, _3));
|
||||
|
|
Loading…
Reference in New Issue