mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 14:14:45 +02:00
ApiListener#RotateLogFile(): don't overwrite previous log
This commit is contained in:
parent
f44e847717
commit
997d84bfa0
@ -1148,13 +1148,11 @@ 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());
|
||||
// If the log is being rotated more than once per second,
|
||||
// don't overwrite the previous one, but silently deny rotation.
|
||||
if (!Utility::PathExists(newpath)) {
|
||||
(void) rename(oldpath.CStr(), newpath.CStr());
|
||||
}
|
||||
}
|
||||
|
||||
void ApiListener::LogGlobHandler(std::vector<int>& files, const String& file)
|
||||
|
Loading…
x
Reference in New Issue
Block a user