Skip to content

Commit 025d7d6

Browse files
Modify the way the log file is opened (#137)
Co-authored-by: linuxserverdev <xinpengtang@163.com>
1 parent 381263b commit 025d7d6

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

trantor/utils/AsyncFileLogger.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,7 @@ AsyncFileLogger::LoggerFile::LoggerFile(const std::string &filePath,
184184
#ifndef _MSC_VER
185185
fp_ = fopen(fileFullName_.c_str(), "a");
186186
#else
187-
if (fopen_s(&fp_, fileFullName_.c_str(), "a") != 0)
188-
{
189-
fp_ = nullptr;
190-
}
187+
fp_ = _fsopen(fileFullName_.c_str(), "a+", _SH_DENYWR);
191188
#endif
192189
if (fp_ == nullptr)
193190
{

0 commit comments

Comments
 (0)