Fix md5-digest-for-port: Don't fail if the total number of bytes read from a port exactly matches the buffer size

This commit is contained in:
eknauel 2005-09-14 11:07:15 +00:00
parent 89db21acf6
commit ac0edb679b
1 changed files with 3 additions and 1 deletions

View File

@ -70,7 +70,9 @@
(init-md5-context! context) (init-md5-context! context)
(let lp () (let lp ()
(let ((got (read-block buffer 0 buffer-size port))) (let ((got (read-block buffer 0 buffer-size port)))
(cond ((< got buffer-size) (cond ((eof-object? got)
(md5-context->md5-digest context))
((< got buffer-size)
(if (not (eof-object? (peek-char port))) (if (not (eof-object? (peek-char port)))
(error "read-block didn't read port to the end")) (error "read-block didn't read port to the end"))
(update-md5-context! context (substring buffer 0 got)) (update-md5-context! context (substring buffer 0 got))