diff options
author | Mikio Hara <mikioh.mikioh@gmail.com> | 2015-04-16 23:10:56 +0900 |
---|---|---|
committer | Mikio Hara <mikioh.mikioh@gmail.com> | 2015-04-18 02:19:46 +0000 |
commit | ec1144423f45e010c72363fe59291d43214b6e31 (patch) | |
tree | 1f81d630919e08b43c7e048096419d9f6d15bb27 /src/net/tcpsock_plan9.go | |
parent | 951f74c4d0bad3efb1eaea3ad6a8bf16ac53ec36 (diff) | |
download | go-git-ec1144423f45e010c72363fe59291d43214b6e31.tar.gz |
net: fix inconsistent error values on Read
This change fixes inconsistent error values on Read,
ReadFrom{,UDP,IP,Unix} and ReadMsg{UDP,IP,Unix}.
Updates #4856.
Change-Id: I7de5663094e09be2d78cdb18ce6f1e7ec260888d
Reviewed-on: https://go-review.googlesource.com/8992
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/net/tcpsock_plan9.go')
-rw-r--r-- | src/net/tcpsock_plan9.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/net/tcpsock_plan9.go b/src/net/tcpsock_plan9.go index ae2194277d..2e646edf50 100644 --- a/src/net/tcpsock_plan9.go +++ b/src/net/tcpsock_plan9.go @@ -23,7 +23,11 @@ func newTCPConn(fd *netFD) *TCPConn { // ReadFrom implements the io.ReaderFrom ReadFrom method. func (c *TCPConn) ReadFrom(r io.Reader) (int64, error) { - return genericReadFrom(c, r) + n, err := genericReadFrom(c, r) + if err != nil && err != io.EOF { + err = &OpError{Op: "read", Net: c.fd.net, Addr: c.fd.raddr, Err: err} + } + return n, err } // CloseRead shuts down the reading side of the TCP connection. |