mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
windows: allow serving files open for write
https://github.com/warmcat/libwebsockets/issues/2713
This commit is contained in:
parent
162e11e530
commit
50f32d0da2
1 changed files with 5 additions and 6 deletions
|
@ -43,13 +43,12 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops_own,
|
|||
LARGE_INTEGER llFileSize = {0};
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, LWS_ARRAY_SIZE(buf));
|
||||
if (((*flags) & 7) == _O_RDONLY) {
|
||||
ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
} else {
|
||||
if (((*flags) & 7) == _O_RDONLY)
|
||||
ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
else
|
||||
ret = CreateFileW(buf, GENERIC_WRITE, 0, NULL,
|
||||
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
}
|
||||
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (ret == LWS_INVALID_FILE)
|
||||
goto bail;
|
||||
|
|
Loading…
Add table
Reference in a new issue