aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-11-29 11:20:50 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-11-29 11:20:50 +0100
commit6e0cbc666b60515b5e201dd28855f5fe1de9a107 (patch)
tree3c575e934736b0e85a456b9ee4e042c89e3d969b /src
parente1420c66a4c76794bfe0b43425d6540bdcbe8e22 (diff)
createTempFile(): Mark file as CLOEEXEC
Fixes #5674.
Diffstat (limited to 'src')
-rw-r--r--src/libutil/util.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index defb77a10..1b6467eb2 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -512,6 +512,7 @@ std::pair<AutoCloseFD, Path> createTempFile(const Path & prefix)
AutoCloseFD fd(mkstemp((char *) tmpl.c_str()));
if (!fd)
throw SysError("creating temporary file '%s'", tmpl);
+ closeOnExec(fd.get());
return {std::move(fd), tmpl};
}