diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-09-22 22:13:51 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-09-23 00:33:50 +0200 |
commit | 48e488eb2c2870088369d2dd69012abaa2376083 (patch) | |
tree | d19d7ef327806029f15455ebbff5e2d67ec123ec /guix/nar.scm | |
parent | f566d765a1494e6c1194a5d7c84f4f16ae8fb81b (diff) | |
download | gnu-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/nar.scm')
-rw-r--r-- | guix/nar.scm | 9 |
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) |