Merge pull request #6639 from Icinga/fix/windows-api-log-rename

Ensure to _unlink before renaming replay log on Windows
This commit is contained in:
Michael Friedrich 2018-09-27 08:02:00 +02:00 committed by GitHub
commit 64e273afdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -1086,6 +1086,13 @@ void ApiListener::RotateLogFile()
String oldpath = GetApiDir() + "log/current";
String newpath = GetApiDir() + "log/" + Convert::ToString(static_cast<int>(ts)+1);
#ifdef _WIN32
_unlink(newpath.CStr());
#endif /* _WIN32 */
(void) rename(oldpath.CStr(), newpath.CStr());
}