channel-read/write: apply channel-blocking? to a closed channel NOT.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 12 Sep 2013 16:45:50 +0000 (09:45 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 12 Sep 2013 16:45:50 +0000 (09:45 -0700)
src/runtime/io.scm

index df1da9a022ab28f007af7c492e074c003b9e4b7d..6ae8849130ffb9774e7bd2d925337670dce0c241 100644 (file)
@@ -180,9 +180,12 @@ USA.
       (if (eq? n #t)
          (begin
            (handle-subprocess-status-change)
-           (if (channel-blocking? channel)
-               (loop)
-               #f))
+           (without-interrupts
+            (lambda ()
+              (if (and (channel-open? channel)
+                       (channel-blocking? channel))
+                  (loop)
+                  #f))))
          n))))
 
 (define (%channel-read channel buffer start end)
@@ -215,9 +218,12 @@ USA.
       (if (eq? n #t)
          (begin
            (handle-subprocess-status-change)
-           (if (channel-blocking? channel)
-               (loop)
-               #f))
+           (without-interrupts
+            (lambda ()
+              (if (and (channel-open? channel)
+                       (channel-blocking? channel))
+                  (loop)
+                  #f))))
          n))))
 
 (define (%channel-write channel buffer start end)