From 48e488eb2c2870088369d2dd69012abaa2376083 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 22 Sep 2013 22:13:51 +0200 Subject: nar: Fix file descriptor leak when writing a Nar. * guix/nar.scm (write-contents)[call-with-binary-input-file]: Always close PORT. --- guix/nar.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'guix') diff --git a/guix/nar.scm b/guix/nar.scm index 29b57dc989..ea119a25fe 100644 --- a/guix/nar.scm +++ b/guix/nar.scm @@ -76,10 +76,11 @@ ;; avoid stat'ing like crazy. (with-fluids ((%file-port-name-canonicalization #f)) (let ((port (open-file file "rb"))) - (catch #t (cut proc port) - (lambda args - (close-port port) - (apply throw args)))))) + (dynamic-wind + (const #t) + (cut proc port) + (lambda () + (close-port port)))))) (write-string "contents" p) (write-long-long size p) -- cgit v1.2.3