mirror of
https://github.com/golang/go
synced 2024-11-24 01:20:08 -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:
parent
a7383fc467
commit
1d3e77607d
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user