Commit 1d3e7760 authored by David du Colombier's avatar David du Colombier

syscall: don't check result of close(fd) in forkAndExecInChild on Plan9

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/17188Reviewed-by: 's avatarRob Pike <r@golang.org>
parent a7383fc4
......@@ -219,10 +219,7 @@ func forkAndExecInChild(argv0 *byte, argv []*byte, envv []envItem, dir *byte, at
// 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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment