summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-05-06 00:29:52 +0000
committerGitHub <noreply@github.com>2025-05-05 17:29:52 -0700
commit0f4a32fccce9106eb00876678fd58a95df62fb5b (patch)
tree14e1162a3090d1e6aacbe7543017f75c73efd9d9
parent6907ea5c8f83712f40fbc7713de4f4bb656c6c35 (diff)
Fix the intermittent failures of tests/autodiff/auto-differential-type (#7006)
The use of `_wfopen_s()` was incorrect in a way the the result value had to be checked. However, even with a proper handling of the failed case, the repro-rate was same. The issue was reproduced at 5%~20% rate with the following commands, build/Release/bin/slang-test.exe tests/autodiff/auto-differential-type -api dx11 -use-test-server -server-count 8 Co-authored-by: Yong He <yonghe@outlook.com>
-rw-r--r--source/core/slang-stream.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/core/slang-stream.cpp b/source/core/slang-stream.cpp
index 07c7e858c..a6ddfe1e9 100644
--- a/source/core/slang-stream.cpp
+++ b/source/core/slang-stream.cpp
@@ -162,10 +162,15 @@ SlangResult FileStream::_init(
SLANG_ASSERT(!"Invalid file share mode.");
return SLANG_FAIL;
}
+
if (share == FileShare::None)
- _wfopen_s(&m_handle, fileName.toWString(), wideMode);
+ {
+ m_handle = _wfsopen(fileName.toWString(), wideMode, _SH_DENYNO);
+ }
else
+ {
m_handle = _wfsopen(fileName.toWString(), wideMode, shFlag);
+ }
#else
m_handle = fopen(fileName.getBuffer(), mode);
#endif