]> Cypherpunks.ru repositories - gostls13.git/commitdiff
syscall: clarify which handles are affected by SysProcAttr.NoInheritHandles
authorqmuntal <quimmuntal@gmail.com>
Fri, 23 Jun 2023 10:44:15 +0000 (12:44 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Tue, 27 Jun 2023 16:16:24 +0000 (16:16 +0000)
SysProcAttr.NoInheritHandles doc comment is not clear about which
handles are affected by it. This CL clarifies that it not only affects
the ones passed in AdditionalInheritedHandles, but also the ones
passed in ProcAttr.Files, which are required to be stderr, stdin and
stdout when calling syscall.StartProcess.

Updates #60942

Change-Id: I5bc5b3604b6db04b83f6764d5c5ffbdafeeb22fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/505515
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/syscall/exec_windows.go

index 45295dedffbe73a964004a1b0123667eff2797c4..0a93bc0a80d4edd11a15ac5be57695cae0c3c7ac 100644 (file)
@@ -247,7 +247,7 @@ type SysProcAttr struct {
        Token                      Token               // if set, runs new process in the security context represented by the token
        ProcessAttributes          *SecurityAttributes // if set, applies these security attributes as the descriptor for the new process
        ThreadAttributes           *SecurityAttributes // if set, applies these security attributes as the descriptor for the main thread of the new process
-       NoInheritHandles           bool                // if set, each inheritable handle in the calling process is not inherited by the new process
+       NoInheritHandles           bool                // if set, no handles are inherited by the new process, not even the standard handles, contained in ProcAttr.Files, nor the ones contained in AdditionalInheritedHandles
        AdditionalInheritedHandles []Handle            // a list of additional handles, already marked as inheritable, that will be inherited by the new process
        ParentProcess              Handle              // if non-zero, the new process regards the process given by this handle as its parent process, and AdditionalInheritedHandles, if set, should exist in this parent process
 }