summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--guix/lzlib.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/guix/lzlib.scm b/guix/lzlib.scm
index 31d84971cb..24c7b4b448 100644
--- a/guix/lzlib.scm
+++ b/guix/lzlib.scm
@@ -510,9 +510,13 @@ the end-of-stream has been reached."
              (start start))
     (cond ((< read count)
            (match (lz-decompress-read decoder bv start (- count read))
-             (0 (if (eof-object? (feed-decoder! decoder))
-                    read
-                    (loop read start)))
+             (0 (cond ((lz-decompress-finished? decoder)
+                       read)
+                      ((eof-object? (feed-decoder! decoder))
+                       (lz-decompress-finish decoder)
+                       (loop read start))
+                      (else                       ;read again
+                       (loop read start))))
              (n (loop (+ read n) (+ start n)))))
           (else
            read))))