From: Eric Wong Date: Fri, 13 May 2011 00:22:57 +0000 (-0700) Subject: copy_stream: update src_offset on retries X-Git-Tag: v4.0.0~5 X-Git-Url: https://repo.or.cz/w/ruby_io_splice.git/commitdiff_plain/e887427daad73f460c1e7abbbefecc22cddbadc3 copy_stream: update src_offset on retries Oops :x --- diff --git a/lib/io/splice.rb b/lib/io/splice.rb index 0802c3b..54a3f04 100644 --- a/lib/io/splice.rb +++ b/lib/io/splice.rb @@ -48,6 +48,7 @@ module IO::Splice rv = 0 while n = partial(src, dst, PIPE_CAPA, src_offset) rv += n + src_offset += n if src_offset end end else @@ -55,11 +56,13 @@ module IO::Splice close.concat(tmp) if len while len != 0 && n = partial(src, w, len, src_offset) + src_offset += n if src_offset len -= full(r, dst, n, nil) end else rv = 0 while n = partial(src, w, PIPE_CAPA, src_offset) + src_offset += n if src_offset rv += full(r, dst, n, nil) end end