Fix exception in PerfdataWriter::RotateFile

fixes #11801
This commit is contained in:
Gunnar Beutner 2016-05-18 14:01:32 +02:00
parent 9687e27c38
commit 0e76876228

View File

@ -123,6 +123,7 @@ void PerfdataWriter::RotateFile(std::ofstream& output, const String& temp_path,
if (output.good()) {
output.close();
if (Utility::PathExists(temp_path)) {
String finalFile = perfdata_path + "." + Convert::ToString((long)Utility::GetTime());
if (rename(temp_path.CStr(), finalFile.CStr()) < 0) {
BOOST_THROW_EXCEPTION(posix_error()
@ -131,6 +132,7 @@ void PerfdataWriter::RotateFile(std::ofstream& output, const String& temp_path,
<< boost::errinfo_file_name(temp_path));
}
}
}
output.open(temp_path.CStr());