diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index c549ec08d..cb024e1fd 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -1232,7 +1232,13 @@ void ApiListener::RotateLogFile() // 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()); + try { + Utility::RenameFile(oldpath, newpath); + } catch (const std::exception& ex) { + Log(LogCritical, "ApiListener") + << "Cannot rotate replay log file from '" << oldpath << "' to '" + << newpath << "': " << ex.what(); + } } }