Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mingw: work around incorrect standard handles
For some reason, when being called via TortoiseGit the standard handles, or at least what is returned by _get_osfhandle(0) for standard input, can take on the value (HANDLE)-2 (which is not a legal value, according to the documentation). Even if this value is not documented anywhere, CreateProcess() works without complaints if hStdInput set to this value. In contrast, when our new code to restrict which file handles get inherited by spawned processes apparently uses such a value in its handle list, it does *not* work, erroring out with `ERROR_INVALID_PARAMETER`. To help this, special-case the value (HANDLE)-2 returned by _get_osfhandle() and replace it with INVALID_HANDLE_VALUE, which will hopefully let the handle inheritance restriction work even when called from TortoiseGit. This addresses git-for-windows#1481 Signed-off-by: Johannes Schindelin <[email protected]>
- Loading branch information