mirror of
https://github.com/golang/go
synced 2024-11-19 15:54:46 -07:00
net: set CLOEXEC on sockets used for capability probes
Fixes #22349 Change-Id: I84ec4fa9fa95bac0f26bf4ca3e62a35dff4f7e00 Reviewed-on: https://go-review.googlesource.com/86015 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
86cca11ffd
commit
f05c8b48ea
@ -24,7 +24,7 @@ import (
|
||||
// general. Unfortunately, we need to run on kernels built without
|
||||
// IPv6 support too. So probe the kernel to figure it out.
|
||||
func (p *ipStackCapabilities) probe() {
|
||||
s, err := socketFunc(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_TCP)
|
||||
s, err := sysSocket(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_TCP)
|
||||
switch err {
|
||||
case syscall.EAFNOSUPPORT, syscall.EPROTONOSUPPORT:
|
||||
case nil:
|
||||
@ -48,7 +48,7 @@ func (p *ipStackCapabilities) probe() {
|
||||
probes = probes[:1]
|
||||
}
|
||||
for i := range probes {
|
||||
s, err := socketFunc(syscall.AF_INET6, syscall.SOCK_STREAM, syscall.IPPROTO_TCP)
|
||||
s, err := sysSocket(syscall.AF_INET6, syscall.SOCK_STREAM, syscall.IPPROTO_TCP)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user