]> Cypherpunks repositories - gostls13.git/commit
syscall: use dup3 in forkAndExecInChild on NetBSD
authorTobias Klauser <tklauser@distanz.ch>
Tue, 26 Oct 2021 07:13:16 +0000 (09:13 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Wed, 27 Oct 2021 06:23:35 +0000 (06:23 +0000)
commit5786a54cfe34069c865fead1b6d9c9e3485a40a5
tree8881e1ea6eb9fa5dad278d2e110896a4bd12c461
parentca5f65d771bc24b9717dca615fa4ad25dcd94fad
syscall: use dup3 in forkAndExecInChild on NetBSD

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

The dup3 syscall was added in NetBSD 6.0.

Change-Id: I01a4f8c62bfa8fb7f9f3166070380dd2002bb564
Reviewed-on: https://go-review.googlesource.com/c/go/+/358755
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/syscall/exec_bsd.go
src/syscall/syscall_dragonfly.go
src/syscall/syscall_netbsd.go
src/syscall/syscall_openbsd_mips64.go