mirror of https://github.com/Icinga/icinga2.git
Throw exception if PerfdataWriter::RotateFile fails to rename from host_temp_path to host_perfdata_path (and same for service)
This can happen if the two paths are not on the same mount-point. fixes #9236 Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
This commit is contained in:
parent
89c7b5a900
commit
88806b031b
|
@ -124,7 +124,12 @@ void PerfdataWriter::RotateFile(std::ofstream& output, const String& temp_path,
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
String finalFile = perfdata_path + "." + Convert::ToString((long)Utility::GetTime());
|
String finalFile = perfdata_path + "." + Convert::ToString((long)Utility::GetTime());
|
||||||
(void) rename(temp_path.CStr(), finalFile.CStr());
|
if (rename(temp_path.CStr(), finalFile.CStr()) < 0) {
|
||||||
|
BOOST_THROW_EXCEPTION(posix_error()
|
||||||
|
<< boost::errinfo_api_function("rename")
|
||||||
|
<< boost::errinfo_errno(errno)
|
||||||
|
<< boost::errinfo_file_name(temp_path));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output.open(temp_path.CStr());
|
output.open(temp_path.CStr());
|
||||||
|
|
Loading…
Reference in New Issue