From 1d3e77607dcc15194f3e772dc5b58980798a6ea5 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 24 Nov 2015 18:54:58 +0100 Subject: [PATCH] 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 --- src/syscall/exec_plan9.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/syscall/exec_plan9.go b/src/syscall/exec_plan9.go index 490bdd71e1..d342cb02bc 100644 --- a/src/syscall/exec_plan9.go +++ b/src/syscall/exec_plan9.go @@ -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 { -- 2.50.0