Merge pull request #5683 from edolstra/nix-develop-cloexec

createTempFile(): Mark file as CLOEEXEC
This commit is contained in:
Eelco Dolstra 2021-11-29 12:35:18 +01:00 committed by GitHub
commit 92bcd77a67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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};
}