summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-11-22 14:41:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-23 02:17:01 (GMT)
commitc5a03b1e29c69f3f06c8fabd92493edb73469176 (patch)
tree77467495d675691a6dabce121a76929038d4a921 /compat/mingw.c
parenteea4a7f4b3620df1b0bd3c1eb1d27e6fd4cb2ff5 (diff)
downloadgit-c5a03b1e29c69f3f06c8fabd92493edb73469176.zip
git-c5a03b1e29c69f3f06c8fabd92493edb73469176.tar.gz
git-c5a03b1e29c69f3f06c8fabd92493edb73469176.tar.bz2
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() seems to work fine without complaints if hStdInput set to this value. In contrast, the upcoming code to restrict which file handles get inherited by spawned processes would result in `ERROR_INVALID_PARAMETER` when including such handle values in the list. 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 fixes https://github.com/git-for-windows/git/issues/1481 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.c')
0 files changed, 0 insertions, 0 deletions