1
0
mirror of https://github.com/golang/go synced 2024-11-17 22:14:43 -07:00

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/17188
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
David du Colombier 2015-11-24 18:54:58 +01:00
parent a7383fc467
commit 1d3e77607d

View File

@ -219,10 +219,7 @@ func forkAndExecInChild(argv0 *byte, argv []*byte, envv []envItem, dir *byte, at
// Close fds we don't need. // Close fds we don't need.
for i = 0; i < len(fdsToClose); i++ { for i = 0; i < len(fdsToClose); i++ {
r1, _, _ = RawSyscall(SYS_CLOSE, uintptr(fdsToClose[i]), 0, 0) RawSyscall(SYS_CLOSE, uintptr(fdsToClose[i]), 0, 0)
if int32(r1) == -1 {
goto childerror
}
} }
if envv != nil { if envv != nil {