Skip to content

Commit

Permalink
Clarify file sharing flags in FML filesystem APIs on Windows
Browse files Browse the repository at this point in the history
Use shared mode when requesting read access and exclusive mode for write access
  • Loading branch information
jason-simmons committed Dec 9, 2022
1 parent 030950f commit abb4f3a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fml/platform/win/file_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ static DWORD GetDesiredAccessFlags(FilePermission permission) {
static DWORD GetShareFlags(FilePermission permission) {
switch (permission) {
case FilePermission::kRead:
return FILE_SHARE_READ;
return FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
case FilePermission::kWrite:
return FILE_SHARE_WRITE;
return 0;
case FilePermission::kReadWrite:
return FILE_SHARE_READ | FILE_SHARE_WRITE;
return 0;
}
return FILE_SHARE_READ;
}
Expand Down

0 comments on commit abb4f3a

Please sign in to comment.