aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-09-22 22:13:51 +0200
committerLudovic Courtès <ludo@gnu.org>2013-09-23 00:33:50 +0200
commit48e488eb2c2870088369d2dd69012abaa2376083 (patch)
treed19d7ef327806029f15455ebbff5e2d67ec123ec /guix
parentf566d765a1494e6c1194a5d7c84f4f16ae8fb81b (diff)
downloadgnu-guix-48e488eb2c2870088369d2dd69012abaa2376083.tar
gnu-guix-48e488eb2c2870088369d2dd69012abaa2376083.tar.gz
nar: Fix file descriptor leak when writing a Nar.
* guix/nar.scm (write-contents)[call-with-binary-input-file]: Always close PORT.
Diffstat (limited to 'guix')
-rw-r--r--guix/nar.scm9
1 files changed, 5 insertions, 4 deletions
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)