summaryrefslogtreecommitdiff
path: root/guix/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-17 07:18:46 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-17 07:18:46 +0200
commit57db49cc3e7a734d684acd5aca36f246ba80be1b (patch)
tree51dfd89d7b45199f1ae07240679c52e8a6653871 /guix/utils.scm
parente617a861378ded7bba8ccc6684b6bb5efc26e1c2 (diff)
utils: Create temporary files in $TMPDIR or /tmp.
Reported by Federico Beffa <beffa@ieee.org>. * guix/utils.scm (call-with-temporary-output-file): Prepend $TMPDIR or /tmp to TEMPLATE.
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index b61ff2477d..34a5e6c971 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -600,8 +600,9 @@ REPLACEMENT."
"Call PROC with a name of a temporary file and open output port to that
file; close the file and delete it when leaving the dynamic extent of this
call."
- (let* ((template (string-copy "guix-file.XXXXXX"))
- (out (mkstemp! template)))
+ (let* ((directory (or (getenv "TMPDIR") "/tmp"))
+ (template (string-append directory "/guix-file.XXXXXX"))
+ (out (mkstemp! template)))
(dynamic-wind
(lambda ()
#t)