From f75084056372e4c76020808b8aa7b26663f4cc97 Mon Sep 17 00:00:00 2001 From: Rafi Wiener Date: Mon, 17 Sep 2018 11:18:33 +0300 Subject: [PATCH] handle failure of file removal --- include/spdlog/sinks/rotating_file_sink.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/spdlog/sinks/rotating_file_sink.h b/include/spdlog/sinks/rotating_file_sink.h index 7ed2385a..e15a2d98 100644 --- a/include/spdlog/sinks/rotating_file_sink.h +++ b/include/spdlog/sinks/rotating_file_sink.h @@ -101,7 +101,10 @@ private: // this is a workaround to a windows issue, where very high rotation // rates sometimes fail (because of antivirus?). details::os::sleep_for_millis(20); - details::os::remove(target); + if (details::os::remove(target) != 0) + { + throw spdlog_ex("rotating_file_sink: failed removing " + filename_to_str(target), errno); + } if (details::os::rename(src, target) != 0) { throw spdlog_ex(