mirror of
https://github.com/golang/go.git
synced 2025-05-16 21:04:38 +00: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
|
// general. Unfortunately, we need to run on kernels built without
|
||||||
// IPv6 support too. So probe the kernel to figure it out.
|
// IPv6 support too. So probe the kernel to figure it out.
|
||||||
func (p *ipStackCapabilities) probe() {
|
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 {
|
switch err {
|
||||||
case syscall.EAFNOSUPPORT, syscall.EPROTONOSUPPORT:
|
case syscall.EAFNOSUPPORT, syscall.EPROTONOSUPPORT:
|
||||||
case nil:
|
case nil:
|
||||||
@ -48,7 +48,7 @@ func (p *ipStackCapabilities) probe() {
|
|||||||
probes = probes[:1]
|
probes = probes[:1]
|
||||||
}
|
}
|
||||||
for i := range probes {
|
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 {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user