mirror of
https://github.com/golang/go
synced 2024-11-22 18:34:51 -07:00
net: if accept4 returns EINVAL fall back to accept
R=golang-dev, andybalholm, mikioh.mikioh CC=golang-dev https://golang.org/cl/7485045
This commit is contained in:
parent
ef7705f6dd
commit
30b89a84ac
@ -44,8 +44,8 @@ func sysSocket(f, t, p int) (int, error) {
|
||||
func accept(fd int) (int, syscall.Sockaddr, error) {
|
||||
nfd, sa, err := syscall.Accept4(fd, syscall.SOCK_NONBLOCK|syscall.SOCK_CLOEXEC)
|
||||
// The accept4 system call was introduced in Linux 2.6.28. If
|
||||
// we get an ENOSYS error, fall back to using accept.
|
||||
if err == nil || err != syscall.ENOSYS {
|
||||
// we get an ENOSYS or EINVAL error, fall back to using accept.
|
||||
if err == nil || (err != syscall.ENOSYS && err != syscall.EINVAL) {
|
||||
return nfd, sa, err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user