From 264fa8be61f503a1c9952b70633018e752afd226 Mon Sep 17 00:00:00 2001 From: Masamichi Hosoda Date: Sat, 9 Jul 2016 01:16:39 +0900 Subject: [PATCH] Issue 4923/1: Add closing a file in `is-collection-fonts?` This commit adds `close-port` for closing a file in `is-collection-fonts?`. --- scm/framework-ps.scm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index bc6599c70b..6e03a3b967 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -288,16 +288,19 @@ (define (load-font-via-GS font-name-filename) (define (is-collection-font? file-name) - (let ((port (open-file file-name "rb"))) - (if (eq? (read-char port) #\t) - (if (eq? (read-char port) #\t) - (if (eq? (read-char port) #\c) - (if (eq? (read-char port) #\f) - #t - #f) - #f) - #f) - #f))) + (let* ((port (open-file file-name "rb")) + (retval + (if (eq? (read-char port) #\t) + (if (eq? (read-char port) #\t) + (if (eq? (read-char port) #\c) + (if (eq? (read-char port) #\f) + #t + #f) + #f) + #f) + #f))) + (close-port port) + retval)) (define (ps-load-file file-name) (if (string? file-name) -- 2.39.2