]> Cypherpunks repositories - gostls13.git/commit
syscall: use dup3 in forkAndExecInChild1 if available
authorTobias Klauser <tklauser@distanz.ch>
Sun, 23 Feb 2020 17:14:34 +0000 (18:14 +0100)
committerTobias Klauser <tobias.klauser@gmail.com>
Mon, 24 Feb 2020 08:31:48 +0000 (08:31 +0000)
commit31acdcc701cb97040832bce371fdd8985fbea131
tree40739e5585d28210734fd045be34f612751ced2c
parent87c0db9916f992d5e869450deccc1185f642bfc9
syscall: use dup3 in forkAndExecInChild1 if available

The dup3 syscall is available since Linux 2.6.27. Fall back to dup2 (if
available) if dup3 returns ENOSYS.

This allows to omit the additional fcntl call to mark the dup'ed fd as
close-on-exec.

Change-Id: If318b593edd783f2aa988534c6062498e7119ddb
Reviewed-on: https://go-review.googlesource.com/c/go/+/220422
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/syscall/exec_linux.go