summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-09-08 20:56:57 +0200
committerMarius Bakke <marius@gnu.org>2022-09-08 20:56:57 +0200
commitfa894b3f4db835bd0bb52b32c7ec412e72b7e03a (patch)
tree2e06c29a1272ca0fad677184706ee95052993009 /gnu/build
parent6cfb2e6270b2759fb98a0de665235bcbb9b9eccf (diff)
parente8bded2de72c17317d7799b699a724086f92ed7b (diff)
downloadguix-fa894b3f4db835bd0bb52b32c7ec412e72b7e03a.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/file-systems.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index b9d46c9350..0ed5dc5671 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -98,6 +98,18 @@ standard input is /dev/null."
              system*/console)
          program args))
 
+(define (call-with-input-file file proc)
+  "Like 'call-with-input-file', but pass O_CLOEXEC."
+  (let ((port #f))
+    (dynamic-wind
+      (lambda ()
+        (set! port (open file (logior O_RDONLY O_CLOEXEC))))
+      (lambda ()
+        (proc port))
+      (lambda ()
+        (close-port port)
+        (set! port #f)))))
+
 (define (bind-mount source target)
   "Bind-mount SOURCE at TARGET."
   (mount source target "" MS_BIND))
@@ -1183,7 +1195,8 @@ corresponds to the symbols listed in FLAGS."
                  (not (file-is-directory? source)))
             (unless (file-exists? target)
               (mkdir-p (dirname target))
-              (call-with-output-file target (const #t)))
+              (close-fdes
+               (open-fdes target (logior O_WRONLY O_CREAT O_CLOEXEC))))
             (mkdir-p target))
 
         (cond