Skip to content

Commit

Permalink
Fix exception in PerfdataWriter::RotateFile
Browse files Browse the repository at this point in the history
fixes #11801
  • Loading branch information
gunnarbeutner committed May 19, 2016
1 parent 9687e27 commit 0e76876
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/perfdata/perfdatawriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 123,14 @@ void PerfdataWriter::RotateFile(std::ofstream& output, const String& temp_path,
if (output.good()) {
output.close();

String finalFile = perfdata_path "." Convert::ToString((long)Utility::GetTime());
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));
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()
<< boost::errinfo_api_function("rename")
<< boost::errinfo_errno(errno)
<< boost::errinfo_file_name(temp_path));
}
}
}

Expand Down

0 comments on commit 0e76876

Please sign in to comment.