]> Cypherpunks repositories - gostls13.git/commit
syscall: use fcntl F_DUP2FD_CLOEXEC in forkAndExecInChild on illumos
authorTobias Klauser <tklauser@distanz.ch>
Mon, 25 Oct 2021 11:37:29 +0000 (13:37 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Tue, 26 Oct 2021 05:02:53 +0000 (05:02 +0000)
commitec6c00418c83aa4f68a5afc9803831f43f8d794f
treed3261a139ab78281420ba2ff0450a48050580a4b
parentadfb85b3150d5ebe36440f82d83be88403951319
syscall: use fcntl F_DUP2FD_CLOEXEC in forkAndExecInChild on illumos

Use fcntl(oldfd, F_DUP2FD_CLOEXEC, newfd) to duplicate the file
descriptor and mark is as close-on-exec instead of dup2 & fcntl.

Illumos implements dup3 like this in libc.

Change-Id: I9782bce553ffb832e9b1a12bbf3c0a40c821f56e
Reviewed-on: https://go-review.googlesource.com/c/go/+/358374
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/syscall/exec_libc.go
src/syscall/syscall_aix.go
src/syscall/syscall_solaris.go