nar: Fix file descriptor leak when writing a Nar.
* guix/nar.scm (write-contents)[call-with-binary-input-file]: Always close PORT.master
parent
f566d765a1
commit
48e488eb2c
|
@ -76,10 +76,11 @@
|
||||||
;; avoid stat'ing like crazy.
|
;; avoid stat'ing like crazy.
|
||||||
(with-fluids ((%file-port-name-canonicalization #f))
|
(with-fluids ((%file-port-name-canonicalization #f))
|
||||||
(let ((port (open-file file "rb")))
|
(let ((port (open-file file "rb")))
|
||||||
(catch #t (cut proc port)
|
(dynamic-wind
|
||||||
(lambda args
|
(const #t)
|
||||||
(close-port port)
|
(cut proc port)
|
||||||
(apply throw args))))))
|
(lambda ()
|
||||||
|
(close-port port))))))
|
||||||
|
|
||||||
(write-string "contents" p)
|
(write-string "contents" p)
|
||||||
(write-long-long size p)
|
(write-long-long size p)
|
||||||
|
|
Reference in New Issue