]> Cypherpunks repositories - gostls13.git/commit
syscall: do not use handle lists on windows when NoInheritHandles is true
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 16 Sep 2021 22:11:19 +0000 (16:11 -0600)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 17 Sep 2021 00:31:49 +0000 (00:31 +0000)
commit14e812bfc575400a02e9e7536344a3f78a6cba08
treeaab7c0edb1668eee3a4005075d1ca829660fe449
parent8d2a9c32a28838978f5d4e477bbd6db4144005d3
syscall: do not use handle lists on windows when NoInheritHandles is true

If NoInheritHandles is passed, then we shouldn't attempt to do anything
with handle lists. Otherwise CreateProcess fails with invalid param,
because it's being told both to not inherit handles and to inherit
certain handles.

This commit fixes that by using the same logic for handle lists as it
does for enabling or disabling handle inheritance. It also adds a test
to make sure this doesn't regress again.

Fixes #48040

Change-Id: I507261baeec263091738ab90157a991d917dc92f
Reviewed-on: https://go-review.googlesource.com/c/go/+/350411
Reviewed-by: Patrik Nyblom <pnyb@google.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/os/exec/exec_windows_test.go
src/syscall/exec_windows.go