guix-commits
[Top][All Lists]
Advanced

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

08/09: accounts: Close database before renaming it.


From: guix-commits
Subject: 08/09: accounts: Close database before renaming it.
Date: Wed, 5 Jun 2019 17:11:22 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit ed8570dce3683b73bdf668b3ad0f529a1cea30c5
Author: Ludovic Court├Ęs <address@hidden>
Date:   Wed Jun 5 11:12:21 2019 +0200

    accounts: Close database before renaming it.
    
    Fixes <https://bugs.gnu.org/35996>.
    Reported by Florian Pelz <address@hidden>.
    
    * gnu/build/accounts.scm (database-writer): Move 'close-port' call
    before 'rename-file'.
---
 gnu/build/accounts.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/build/accounts.scm b/gnu/build/accounts.scm
index 8687446..2120c1d 100644
--- a/gnu/build/accounts.scm
+++ b/gnu/build/accounts.scm
@@ -249,9 +249,11 @@ to it atomically and set the appropriate permissions."
             (lambda ()
               (chmod port mode)
               (write-entries port)
+              (close-port port)
               (rename-file template file-or-port))
             (lambda ()
-              (close-port port)
+              (unless (port-closed? port)
+                (close-port port))
               (when (file-exists? template)
                 (delete-file template))))))))
 



reply via email to

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