mirror of
https://github.com/curl/curl.git
synced 2026-04-14 18:11:40 +03:00
curlx_win32_fopen: use _fsopen()/_wfsopen() with _SH_DENYNO
Replacing `fopen_s()`/`_wfopen_s()`, to allow customizing share mode,
and keep the sharing mode as was with `fopen()`/`_wopen()` earlier and
as used in `_sopen_s()`/`_wsopen_s()`.
The replaced functions used `_SH_SECURE` internally. Otherwise they are
identical to the replacements.
Ref: https://learn.microsoft.com/cpp/c-runtime-library/reference/fsopen-wfsopen
Reported-by: Jay Satiro
Fixes #20155
Ref: #20156
Follow-up to 1e7d0bafc6 #19643
Closes #20186
This commit is contained in:
parent
64350280d3
commit
e2d61a6b30
1 changed files with 2 additions and 2 deletions
|
|
@ -348,7 +348,7 @@ FILE *curlx_win32_fopen(const char *filename, const char *mode)
|
|||
target = fixed;
|
||||
else
|
||||
target = filename_w;
|
||||
errno = _wfopen_s(&result, target, mode_w);
|
||||
result = _wfsopen(target, mode_w, _SH_DENYNO);
|
||||
}
|
||||
else
|
||||
/* !checksrc! disable ERRNOVAR 1 */
|
||||
|
|
@ -360,7 +360,7 @@ FILE *curlx_win32_fopen(const char *filename, const char *mode)
|
|||
target = fixed;
|
||||
else
|
||||
target = filename;
|
||||
errno = fopen_s(&result, target, mode);
|
||||
result = _fsopen(target, mode, _SH_DENYNO);
|
||||
#endif
|
||||
|
||||
CURLX_FREE(fixed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue