guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/05: utils: 'with-atomic-file-output' closes the port upon exception.


From: Ludovic Courtès
Subject: 03/05: utils: 'with-atomic-file-output' closes the port upon exception.
Date: Mon, 13 Jun 2016 16:08:03 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit c25637dfe8aaf2aa7550c9196fb7e18820552ca6
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jun 13 18:00:29 2016 +0200

    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.
---
 guix/utils.scm |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/utils.scm b/guix/utils.scm
index 18d913c..2d8bfd8 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]