From 05198ddcfb0e0eee6a2a169669145c3de696c5d1 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 30 Mar 2016 20:35:15 -0400 Subject: [PATCH] Fix get_modified_time to avoid race condition on Windows If multiple processes tried to read the same input file simultaneously, get_modified_time would fail. With this change, get_modified_time does not need to actually open the file in order to read the metadata. --- src/base/application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/application.cpp b/src/base/application.cpp index f4db4d52c..0201480c0 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -36,7 +36,7 @@ static std::mutex xml_mutex; static int get_modified_time(const std::string& path) { #ifdef _WIN32 - HANDLE hFile = CreateFile(path.c_str(), GENERIC_READ, FILE_SHARE_WRITE, + HANDLE hFile = CreateFile(path.c_str(), NULL, NULL, NULL, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) { throw CanteraError("get_modified_time", "Couldn't open file:" + path);