From b6c904c1b57533e7a3dd4e15ed58708a06e94bc8 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 28 Jul 2019 11:29:04 +0530 Subject: utils: Return eof-object from read-bytes-till on end of file. * email/utils.scm (read-bytes-till): Return eof-object, not #vu8(), on end of file. * tests/utils.scm: New file. * Makefile.am (SCM_TESTS): Register it. --- email/utils.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'email/utils.scm') diff --git a/email/utils.scm b/email/utils.scm index 2040b21..8344c6b 100644 --- a/email/utils.scm +++ b/email/utils.scm @@ -79,8 +79,9 @@ reached. If SEQUENCE is seen, unget it to PORT and return." (else (put-u8 out octet) (read-bytes-and-write-till in out sequence))))) - (call-with-bytevector-output-port - (cut read-bytes-and-write-till port <> sequence))) + (let ((bv (call-with-bytevector-output-port + (cut read-bytes-and-write-till port <> sequence)))) + (if (bytevector=? bv (make-bytevector 0)) (eof-object) bv))) (define (get-line-with-delimiter port) "Read a line from PORT and return it as a string including the -- cgit v1.2.3