summaryrefslogtreecommitdiffhomepage
path: root/conn
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2022-07-01 21:28:52 -0700
committerJason A. Donenfeld <Jason@zx2c4.com>2022-07-04 01:42:12 +0200
commitc31a7b1ab47807f01613a571cc480f79d5fb4181 (patch)
treef2b8488763ea41386c2d1f61eefc47e667ca7258 /conn
parent6a08d81f6bc465a2276c61093d96e567d00beb24 (diff)
conn, device, tun: set CLOEXEC on fds
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'conn')
-rw-r--r--conn/bind_linux.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/conn/bind_linux.go b/conn/bind_linux.go
index f11f031..03e8707 100644
--- a/conn/bind_linux.go
+++ b/conn/bind_linux.go
@@ -331,7 +331,7 @@ func create4(port uint16) (int, uint16, error) {
fd, err := unix.Socket(
unix.AF_INET,
- unix.SOCK_DGRAM,
+ unix.SOCK_DGRAM|unix.SOCK_CLOEXEC,
0,
)
if err != nil {
@@ -373,7 +373,7 @@ func create6(port uint16) (int, uint16, error) {
fd, err := unix.Socket(
unix.AF_INET6,
- unix.SOCK_DGRAM,
+ unix.SOCK_DGRAM|unix.SOCK_CLOEXEC,
0,
)
if err != nil {