Commit 412f6592 authored by Ian Lance Taylor's avatar Ian Lance Taylor

net: return poll.SendFile error from sendFile

We were accidentally ignoring any error returned by poll.SendFile.
Noticed by reading the code. It could only change behavior if the
sendfile system call both wrote some bytes and returned an error.

Change-Id: I0693d6ec0a30f5a86b78d38793899ca29fb9e156
Reviewed-on: https://go-review.googlesource.com/c/164760
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 7dc3d9f8
......@@ -42,8 +42,8 @@ func sendFile(c *netFD, r io.Reader) (written int64, err error, handled bool) {
written, werr = poll.SendFile(&c.pfd, int(fd), remain)
return true
})
if werr == nil {
werr = err
if err == nil {
err = werr
}
if lr != nil {
......
......@@ -68,8 +68,8 @@ func sendFile(c *netFD, r io.Reader) (written int64, err error, handled bool) {
written, werr = poll.SendFile(&c.pfd, int(fd), pos, remain)
return true
})
if werr == nil {
werr = err
if err == nil {
err = werr
}
if lr != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment