Skip to content

Commit 3cbcec4

Browse files
committed
check for correct EOF value - fix #413
1 parent 09de8cd commit 3cbcec4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pixie/io-blocking.pxi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
(def fclose (ffi-fn libc "fclose" [CVoidP] CInt))
1414
(def popen (ffi-fn libc "popen" [CCharP CCharP] CVoidP))
1515
(def pclose (ffi-fn libc "pclose" [CVoidP] CInt))
16+
(def EOF -1)
1617

1718
(deftype FileStream [fp]
1819
IInputStream
@@ -85,7 +86,7 @@
8586
([cnt chr]
8687
(assert (integer? chr))
8788
(let [written (write-byte fp chr)]
88-
(if (= written 0)
89+
(if (= written EOF)
8990
(reduced cnt)
9091
(+ cnt written)))))))
9192

0 commit comments

Comments
 (0)