Commit bdd39241 authored by Roger Leigh's avatar Roger Leigh Committed by Brad King

Process: On Windows do not open stdin file with write permission

The fix in commit ed7f53e0 (BUG: When handing the child stdin pipe a
file, allow another process to be writing to the file at the same time,
2006-07-17) added `GENERIC_WRITE` but since we do not actually need to
write to the file, only `FILE_SHARE_WRITE` is enough to allow others to
do so.  Remove the request for write permission.

Issue: cmake/cmake#18359
parent bb4a7413
......@@ -973,8 +973,8 @@ void kwsysProcess_Execute(kwsysProcess* cp)
wchar_t* wstdin = kwsysEncoding_DupToWide(cp->PipeFileSTDIN);
DWORD error;
cp->PipeChildStd[0] =
CreateFileW(wstdin, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
CreateFileW(wstdin, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, 0, 0);
error = GetLastError(); /* Check now in case free changes this. */
free(wstdin);
if (cp->PipeChildStd[0] == INVALID_HANDLE_VALUE) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment