From 640542ba69d99109b212ea74dde2b59f4fe1b837 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 2 Jan 2015 19:18:06 +0000 Subject: Fix error logging when file open fails on Windows. We need to use the saved Windows error code from GetLastError(), rather than calling it again, because another system call has run in the mean time and GetLastError() will now return 0. --- lib/common/FileStream.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/common/FileStream.cpp b/lib/common/FileStream.cpp index e38e5d38..51752f85 100644 --- a/lib/common/FileStream.cpp +++ b/lib/common/FileStream.cpp @@ -70,13 +70,13 @@ void FileStream::AfterOpen() #ifdef WIN32 if(errno == EACCES) { - THROW_WIN_FILE_ERROR("Failed to open file", mFileName, - CommonException, AccessDenied); + THROW_WIN_FILE_ERRNO("Failed to open file", mFileName, + winerrno, CommonException, AccessDenied); } else { - THROW_WIN_FILE_ERROR("Failed to open file", mFileName, - CommonException, OSFileOpenError); + THROW_WIN_FILE_ERRNO("Failed to open file", mFileName, + winerrno, CommonException, OSFileOpenError); } #else if(errno == EACCES) -- cgit v1.2.3