From ffb1b0394362931a5815401b18659e7a795067e9 Mon Sep 17 00:00:00 2001 From: Paul Kunysch Date: Tue, 27 Apr 2021 14:33:55 +0200 Subject: [PATCH] Check for errors in file_helper::flush. --- include/spdlog/details/file_helper-inl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/spdlog/details/file_helper-inl.h b/include/spdlog/details/file_helper-inl.h index 30f3cf55..78592ecd 100644 --- a/include/spdlog/details/file_helper-inl.h +++ b/include/spdlog/details/file_helper-inl.h @@ -72,7 +72,10 @@ SPDLOG_INLINE void file_helper::reopen(bool truncate) SPDLOG_INLINE void file_helper::flush() { - std::fflush(fd_); + if (std::fflush(fd_)) + { + throw_spdlog_ex("Failed flushing file " + os::filename_to_str(filename_), errno); + } } SPDLOG_INLINE void file_helper::close()