Skip to content

Commit 43d8c37

Browse files
authored
Merge pull request #70235 from compnerd/deprecated
SwiftShims: silence a deprecation warning on Windows
2 parents d7e22f4 + 6f9a289 commit 43d8c37

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stdlib/public/SwiftShims/swift/shims/LibcOverlayShims.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ static inline int _swift_stdlib_ioctlPtr(int fd, unsigned long int request, void
102102
#if defined(_WIN32) && !defined(__CYGWIN__)
103103
// Windows
104104
static inline int _swift_stdlib_open(const char *path, int oflag, mode_t mode) {
105-
return _open(path, oflag, (int)mode);
105+
int fh;
106+
errno_t err = _sopen_s(&fh, path, oflag, _SH_DENYNO, mode);
107+
__assume(err == 0 || fh == -1);
108+
return fh;
106109
}
107110

108111
#else

0 commit comments

Comments
 (0)