summaryrefslogtreecommitdiff
path: root/src/pkg/syscall/exec_bsd.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/syscall/exec_bsd.go')
-rw-r--r--src/pkg/syscall/exec_bsd.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pkg/syscall/exec_bsd.go b/src/pkg/syscall/exec_bsd.go
index 9c3af5ec9..318cbc060 100644
--- a/src/pkg/syscall/exec_bsd.go
+++ b/src/pkg/syscall/exec_bsd.go
@@ -221,3 +221,17 @@ childerror:
// and this shuts up the compiler.
panic("unreached")
}
+
+// 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
+}