From 4b8bfa6352e8f67886dc1cd1eba92b248715bd11 Mon Sep 17 00:00:00 2001 From: Shawn Walker-Salas Date: Fri, 30 Jun 2017 10:57:04 -0700 Subject: [PATCH] net: fix sendfile for Solaris If a retryable error such as EAGAIN/EINTR is encountered during a call to sendfile(), we should not assume that a partial write occurred. Instead, just like any other platform, we should always try again even if 0 bytes were written. Fixes #20857 Change-Id: I9aa48d193c27c6794c550320da4d3f7544041f37 Reviewed-on: https://go-review.googlesource.com/47351 Run-TryBot: Shawn Walker-Salas TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/internal/poll/sendfile_solaris.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/internal/poll/sendfile_solaris.go b/src/internal/poll/sendfile_solaris.go index 2ce5323208..9093d46483 100644 --- a/src/internal/poll/sendfile_solaris.go +++ b/src/internal/poll/sendfile_solaris.go @@ -33,10 +33,7 @@ func SendFile(dstFD *FD, src int, pos, remain int64) (int64, error) { n, err1 := syscall.Sendfile(dst, src, &pos1, n) if err1 == syscall.EAGAIN || err1 == syscall.EINTR { // partial write may have occurred - if n = int(pos1 - pos); n == 0 { - // nothing more to write - err1 = nil - } + n = int(pos1 - pos) } if n > 0 { pos += int64(n) -- 2.50.0