1
0
mirror of https://github.com/golang/go synced 2024-11-22 13:54:45 -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:
Ian Lance Taylor 2013-03-08 21:18:06 -08:00
parent ef7705f6dd
commit 30b89a84ac

View File

@ -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
}