]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: don't check result of close(fd) in forkAndExecInChild on Plan9
authorDavid du Colombier <0intro@gmail.com>
Tue, 24 Nov 2015 17:54:58 +0000 (18:54 +0100)
committerDavid du Colombier <0intro@gmail.com>
Tue, 24 Nov 2015 18:57:44 +0000 (18:57 +0000)
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>
src/syscall/exec_plan9.go

index 490bdd71e1faa0ce0b3f47564d74a4f07c3a2b8d..d342cb02bc1b43bd5126e92ddd306895481c5fb9 100644 (file)
@@ -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 {