From 94352b37314288b7fe23d44fc14835fcfc70fe33 Mon Sep 17 00:00:00 2001 From: defia Date: Mon, 13 Jun 2016 11:16:19 +0800 Subject: [PATCH] fix issue 461 https://github.com/cyfdecyf/cow/issues/461 --- util.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/util.go b/util.go index 03ae87a6..0907dc0f 100644 --- a/util.go +++ b/util.go @@ -259,16 +259,13 @@ func copyN(dst io.Writer, src *bufio.Reader, n, rdSize int) (err error) { } nr := len(b) n -= nr - if nr > 0 { + for nr > 0 { nw, ew := dst.Write(b) if ew != nil { err = ew break } - if nr != nw { - err = io.ErrShortWrite - break - } + nr -= nw } if er == io.EOF { break