From 87c0770c426dd787df4d76c53eeb42b0ed55ef02 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Mon, 24 Nov 2014 14:18:29 +0200 Subject: [PATCH] Update os.h Provide shared read access to log files under windows --- include/spdlog/details/os.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index 6d46e940..cd9dd61f 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -120,7 +120,8 @@ constexpr inline unsigned short eol_size() inline int fopen_s(FILE** fp, const std::string& filename, const char* mode) { #ifdef _WIN32 - return ::fopen_s(fp, filename.c_str(), mode); + *fp = _fsopen((filename.c_str()), mode, _SH_DENYWR); + return *fp == nullptr; #else *fp = fopen((filename.c_str()), mode); return *fp == nullptr;