Skip to content

Commit

Permalink
always open a stream with FILE_SHARE_DELETE according to the POST gol…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Eggert committed Aug 7, 2020
1 parent 7fbb08c commit ade5efd
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Release/src/streams/fileio_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,21 @@ void _get_create_flags(
}

// C++ specifies what permissions to deny, Windows which permissions to give,
dwShareMode = 0x3;
switch (prot)
{
case _SH_DENYRW: dwShareMode = 0x0; break;
case _SH_DENYWR: dwShareMode = 0x1; break;
case _SH_DENYRD: dwShareMode = 0x2; break;
}
DWORD dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
switch (prot) {
case _SH_DENYRW:
dwShareMode = 0x0;
break;
case _SH_DENYWR:
dwShareMode = FILE_SHARE_READ;
break;
case _SH_DENYRD:
dwShareMode = FILE_SHARE_WRITE;
break;
}

// according to the post of: https://github.com/golang/go/issues/32088#issuecomment-502850674
dwShareMode |= FILE_SHARE_DELETE;
}

/// <summary>
Expand Down

0 comments on commit ade5efd

Please sign in to comment.