utils: 'with-atomic-file-output' closes the port upon exception.
authorLudovic Courtès <ludo@gnu.org>
Mon, 13 Jun 2016 16:00:29 +0000 (18:00 +0200)
committerLudovic Courtès <ludo@gnu.org>
Mon, 13 Jun 2016 16:05:54 +0000 (18:05 +0200)
Previously it could have left the file descriptor open.

* guix/utils.scm (with-atomic-file-output): Call 'close-port' in handler.

guix/utils.scm

index 18d913c..2d8bfd8 100644 (file)
@@ -630,7 +630,8 @@ output port, and PROC's result is returned."
           (rename-file template file)
           result))
       (lambda (key . args)
-        (false-if-exception (delete-file template))))))
+        (false-if-exception (delete-file template))
+        (close-port out)))))
 
 (define (cache-directory)
   "Return the cache directory for Guix, by default ~/.cache/guix."