Skip to content

Commit

Permalink
Conserve error value when trying to open log file
Browse files Browse the repository at this point in the history
  • Loading branch information
RipleyTom authored and Nekotekina committed Oct 24, 2019
1 parent c89ad38 commit a32f979
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Utilities/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ logs::file_writer::file_writer(const std::string& name)
if (!m_file.open(buf_name, fs::read + fs::rewrite + fs::lock))
{
#ifdef _WIN32
auto prev_error = fs::g_tls_error;

if (fs::exists(s_filelock))
{
// A restart is happening, wait for the file to be accessible
Expand All @@ -342,6 +344,10 @@ logs::file_writer::file_writer(const std::string& name)
tries++;
}
}
else
{
fs::g_tls_error = prev_error;
}

if (!m_file)
#endif
Expand Down

0 comments on commit a32f979

Please sign in to comment.