From: Chris Hanson Date: Sun, 29 Jan 2017 06:00:21 +0000 (-0800) Subject: Fix bug: would-block value only returned if nothing has been read. X-Git-Tag: mit-scheme-pucked-9.2.12~227^2~35 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=72ac4b3e49aeb49d4e7542ef27a3c5749a1516e7;p=mit-scheme.git Fix bug: would-block value only returned if nothing has been read. --- 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)))))