~ruther/guix-local

48e488eb2c2870088369d2dd69012abaa2376083 — Ludovic Courtès 12 years ago f566d76
nar: Fix file descriptor leak when writing a Nar.

* guix/nar.scm (write-contents)[call-with-binary-input-file]: Always
  close PORT.
1 files changed, 5 insertions(+), 4 deletions(-)

M guix/nar.scm
M guix/nar.scm => guix/nar.scm +5 -4
@@ 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)