On multiprocessor machines, a file descriptor could be
closed twice in forkAndExecInChild. Consequently, the close
syscall returns the "fd out of range or not open" error
and forkAndExecInChild fails.
This changes forkAndExecInChild to ignore the error
returned by close(fd), as on other operating systems.
Fixes #12851.
Change-Id: I96a8463ce6599bfd1362353283e0329a00f738da
Reviewed-on: https://go-review.googlesource.com/17188
Reviewed-by: Rob Pike <r@golang.org>
// Close fds we don't need.
for i = 0; i < len(fdsToClose); i++ {
- r1, _, _ = RawSyscall(SYS_CLOSE, uintptr(fdsToClose[i]), 0, 0)
- if int32(r1) == -1 {
- goto childerror
- }
+ RawSyscall(SYS_CLOSE, uintptr(fdsToClose[i]), 0, 0)
}
if envv != nil {