aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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))))))))