blob: b4b908abacf21aa15c7ee0f8725290acd5719af5 [file] [log] [blame]
Mikio Haraa877e812014-12-31 10:08:51 +09001// Copyright 2009 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows
6
7package net
8
9import (
10 "io"
11 "syscall"
12)
13
14// eofError returns io.EOF when fd is available for reading end of
15// file.
16func (fd *netFD) eofError(n int, err error) error {
17 if n == 0 && err == nil && fd.sotype != syscall.SOCK_DGRAM && fd.sotype != syscall.SOCK_RAW {
18 return io.EOF
19 }
20 return err
21}