1
0
mirror of https://github.com/golang/go synced 2024-11-19 21:34:45 -07:00

syscall: reuse BSD forkExecPipe for Solaris

The function was duplicated for Solaris. Reuse the BSD version instead.

Change-Id: Ibc812bcf36d21f4a7ceeef7b4fb091fa9479bfa8
Reviewed-on: https://go-review.googlesource.com/81395
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Tobias Klauser 2017-12-01 12:57:57 +00:00 committed by Tobias Klauser
parent 04e6ae6bc3
commit dc27d68936
2 changed files with 2 additions and 15 deletions

View File

@ -261,17 +261,3 @@ childerror:
exit(253) exit(253)
} }
} }
// Try to open a pipe with O_CLOEXEC set on both file descriptors.
func forkExecPipe(p []int) error {
err := Pipe(p)
if err != nil {
return err
}
_, err = fcntl(p[0], F_SETFD, FD_CLOEXEC)
if err != nil {
return err
}
_, err = fcntl(p[1], F_SETFD, FD_CLOEXEC)
return err
}

View File

@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin dragonfly netbsd openbsd // +build darwin dragonfly netbsd openbsd solaris
package syscall package syscall
// Try to open a pipe with O_CLOEXEC set on both file descriptors.
func forkExecPipe(p []int) error { func forkExecPipe(p []int) error {
err := Pipe(p) err := Pipe(p)
if err != nil { if err != nil {