0.8.6.28:
[sbcl.git] / src / code / fd-stream.lisp
index cc71851..2fbafbf 100644 (file)
                                  (+ (fd-stream-obuf-tail stream)
                                     ,size))
                           (flush-output-buffer stream)))
+                    ,(unless (eq (car buffering) :none)
+                       `(when (> (fd-stream-ibuf-tail stream)
+                                 (fd-stream-ibuf-head stream))
+                          (file-position stream (file-position stream))))
+                    
                     ,@body
                     (incf (fd-stream-obuf-tail stream) ,size)
                     ,(ecase (car buffering)
   (let ((start (or start 0))
        (end (or end (length (the (simple-array * (*)) thing)))))
     (declare (type index start end))
+    (when (> (fd-stream-ibuf-tail fd-stream)
+            (fd-stream-ibuf-head fd-stream))
+      (file-position fd-stream (file-position fd-stream)))
     (let* ((len (fd-stream-obuf-length fd-stream))
           (tail (fd-stream-obuf-tail fd-stream))
           (space (- len tail))
     (:element-type
      (fd-stream-element-type fd-stream))
     (:interactive-p
-      ;; FIXME: sb!unix:unix-isatty is undefined.
      (= 1 (the (member 0 1)
             (sb!unix:unix-isatty (fd-stream-fd fd-stream)))))
     (:line-length
                      (open-error "~@<The path ~2I~_~S ~I~_does not exist.~:>"
                                  pathname))
                     (t nil)))
-                 ((and (eql errno sb!unix:eexist) if-exists)
+                 ((and (eql errno sb!unix:eexist) (null if-exists))
                   nil)
                  (t
                   (vanilla-open-error)))))))))