mirror of
https://github.com/golang/go
synced 2024-11-17 06:04:47 -07:00
syscall: fix closing of reordered FDs in plan9 ForkExec
After dup'ing file descriptors in syscall.ProcAttr.Files to pass to the exec'ed process, the logic for closing the old descriptors was incorrect and could close the new descriptor instead. Fixes #57180 Change-Id: I7725f21a465ffba57050fe4e36f3d36ba181cfb2 Reviewed-on: https://go-review.googlesource.com/c/go/+/457115 Run-TryBot: David du Colombier <0intro@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David du Colombier <0intro@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com>
This commit is contained in:
parent
5ba98b9756
commit
cb07765045
@ -276,7 +276,7 @@ dirloop:
|
||||
|
||||
// Pass 3: close fd[i] if it was moved in the previous pass.
|
||||
for i = 0; i < len(fd); i++ {
|
||||
if fd[i] >= 0 && fd[i] != int(i) {
|
||||
if fd[i] >= len(fd) {
|
||||
RawSyscall(SYS_CLOSE, uintptr(fd[i]), 0, 0)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user