When closing a port, don't try to flush output if the channel is
authorChris Hanson <org/chris-hanson/cph>
Thu, 27 May 2004 16:06:31 +0000 (16:06 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 27 May 2004 16:06:31 +0000 (16:06 +0000)
already closed.

v7/src/runtime/genio.scm

index bb88bbf8b775dec41f9cc0633c9f8180fd08b121..c53889b6decbb36d61eda56315a04a56e6f4cd92 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: genio.scm,v 1.31 2004/05/26 15:19:53 cph Exp $
+$Id: genio.scm,v 1.32 2004/05/27 16:06:31 cph Exp $
 
 Copyright 1991,1993,1995,1996,1999,2002 Massachusetts Institute of Technology
 Copyright 2003,2004 Massachusetts Institute of Technology
@@ -718,8 +718,10 @@ USA.
   (channel-open? (output-buffer-channel ob)))
 
 (define (close-output-buffer ob)
-  (force-drain-output-buffer ob)
-  (channel-close (output-buffer-channel ob)))
+  (if (output-buffer-open? ob)
+      (begin
+       (force-drain-output-buffer ob)
+       (channel-close (output-buffer-channel ob)))))
 
 (define-integrable (output-buffer-port ob)
   (channel-port (output-buffer-channel ob)))