]> Cypherpunks repositories - gostls13.git/commit
syscall: use fcntl with F_DUP2FD_CLOEXEC in forkAndExecInChild on FreeBSD
authorTobias Klauser <tklauser@distanz.ch>
Wed, 13 Oct 2021 14:30:16 +0000 (16:30 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Thu, 14 Oct 2021 13:09:28 +0000 (13:09 +0000)
commit24e798e2876f05d628f1e9a32ce8c7f4a3ed3268
treee0653dcad39586e3a708ee258168c41bd6f14c77
parent2feb2cc450e1925b9359957c90bae27e01662171
syscall: use fcntl with F_DUP2FD_CLOEXEC in forkAndExecInChild on FreeBSD

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

FreeBSD implements dup3 like this in libc.

Change-Id: I36e37bc61c2e31561adb49001f287764125a74de
Reviewed-on: https://go-review.googlesource.com/c/go/+/355571
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/syscall/exec_freebsd.go