summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-06-05 11:12:21 +0200
committerLudovic Courtès <ludo@gnu.org>2019-06-05 23:10:37 +0200
commited8570dce3683b73bdf668b3ad0f529a1cea30c5 (patch)
treeb99579be74e885712c43938448bb25bd4bb8a322
parent70a7a1b5dc529de34304dea5aa4d2b58e7a5d305 (diff)
downloadpatches-ed8570dce3683b73bdf668b3ad0f529a1cea30c5.tar
patches-ed8570dce3683b73bdf668b3ad0f529a1cea30c5.tar.gz
accounts: Close database before renaming it.
Fixes <https://bugs.gnu.org/35996>. Reported by Florian Pelz <pelzflorian@pelzflorian.de>. * gnu/build/accounts.scm (database-writer): Move 'close-port' call before 'rename-file'.
-rw-r--r--gnu/build/accounts.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/gnu/build/accounts.scm b/gnu/build/accounts.scm
index 8687446aa6..2120c1d11d 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))))))))