From 72ac4b3e49aeb49d4e7542ef27a3c5749a1516e7 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 28 Jan 2017 22:00:21 -0800 Subject: [PATCH] Fix bug: would-block value only returned if nothing has been read. --- src/runtime/genio.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/runtime/genio.scm b/src/runtime/genio.scm index 8669b9b59..4f9e78fbc 100644 --- a/src/runtime/genio.scm +++ b/src/runtime/genio.scm @@ -236,8 +236,12 @@ USA. (let loop ((index start)) (if (fix:< index end) (let ((char (generic-io/read-char port))) - (cond ((not char) #f) - ((eof-object? char) (fix:- index start)) + (cond ((not char) + (if (fix:< start index) + (fix:- index start) + #f)) + ((eof-object? char) + (fix:- index start)) (else (ustring-set! string index char) (loop (fix:+ index 1))))) -- 2.25.1