about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-12 17:22:57 -0700
committerEric Wong <normalperson@yhbt.net>2011-05-12 17:22:57 -0700
commite887427daad73f460c1e7abbbefecc22cddbadc3 (patch)
tree5a0fb0fe3b29e20f0aeefce32bbded44f31f7ab0
parent7dd97ae08a4c6755427a4e2162d4232cfd1d8cac (diff)
downloadruby_io_splice-e887427daad73f460c1e7abbbefecc22cddbadc3.tar.gz
Oops :x
-rw-r--r--lib/io/splice.rb3
1 files changed, 3 insertions, 0 deletions
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