summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-06-13 18:00:29 +0200
committerLudovic Courtès <ludo@gnu.org>2016-06-13 18:05:54 +0200
commitc25637dfe8aaf2aa7550c9196fb7e18820552ca6 (patch)
treeec5a5840b7ef8657fbb1f7b6f67871f4ae26838b
parentd1f33ba44b60526d20da04d384f3af5437f8a3ae (diff)
downloadguix-c25637dfe8aaf2aa7550c9196fb7e18820552ca6.tar.gz
utils: 'with-atomic-file-output' closes the port upon exception.
Previously it could have left the file descriptor open.

* guix/utils.scm (with-atomic-file-output): Call 'close-port' in handler.
-rw-r--r--guix/utils.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index 18d913c514..2d8bfd84b0 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -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."