summaryrefslogtreecommitdiff
path: root/email
diff options
context:
space:
mode:
authorArun Isaac2019-07-28 11:29:04 +0530
committerArun Isaac2019-07-28 12:13:44 +0530
commitb6c904c1b57533e7a3dd4e15ed58708a06e94bc8 (patch)
tree00fa5fc770abae31b970c53b7bfac31d19371790 /email
parent837f40590396617df78983cfddc586156b1abce9 (diff)
downloadguile-email-b6c904c1b57533e7a3dd4e15ed58708a06e94bc8.tar.gz
guile-email-b6c904c1b57533e7a3dd4e15ed58708a06e94bc8.tar.lz
guile-email-b6c904c1b57533e7a3dd4e15ed58708a06e94bc8.zip
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.
Diffstat (limited to 'email')
-rw-r--r--email/utils.scm5
1 files changed, 3 insertions, 2 deletions
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