When accounting for the octets left in the in-buffer that we haven't
read (or converted to characters), we were subtracting the index from
the total in-buffer length. This is wrong if the file is less than
the total in-buffer length. We should have subtracted from the actual
number of octets in the in-buffer.
#+nil
(progn
(format t "in-buffer-length = ~D~%" in-buffer-length)
+ (format t "in-length = ~D~%" (fd-stream-in-length stream))
(format t "fd-stream-in-index = ~D~%" (fd-stream-in-index stream)))
- (decf posn (- in-buffer-length
+ (decf posn (- (fd-stream-in-length stream)
(fd-stream-in-index stream))))
#+nil
(format t "fd-stream-unread = ~S~%" (fd-stream-unread stream))