Commit 826c30a1 authored by Eric Timmons's avatar Eric Timmons
Browse files

Robustify against streams that error when you call FILE-POSITION

parent ff5d41cc
# cl-tar-file changelog #
## Unreleased
+ Robustify against streams that error when you call FILE-POSITION.
## v0.1.0 - September 22, 2021
First release!
......@@ -91,7 +91,8 @@ of the wrapped stream when instantiated."))
:element-type element-type
:initial-element 0)
;; Record the START-FILE-POSITION
(start-file-position blocked-stream) (file-position stream))))
(start-file-position blocked-stream) (ignore-errors (file-position stream))
(stream-offset blocked-stream) (- (block-size blocked-stream)))))
(defgeneric discard-buffer (stream)
(:documentation
......@@ -144,6 +145,7 @@ the buffer to be written."
(defmethod ensure-buffer-valid ((stream blocked-stream))
(cond
((not (buffer-valid-p stream))
(incf (stream-offset stream) (block-size stream))
(fill-buffer stream))
((= (index stream) (block-size stream))
(discard-buffer stream)
......@@ -229,7 +231,7 @@ the buffer to be written."
:do
(discard-buffer stream)
(setf (index stream) (block-size stream))
(ensure-buffer-valid))))
(ensure-buffer-valid stream))))
(cond
((and (= start-of-chunk-position (stream-offset stream))
(or (null (eof-index stream))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment