1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 17:51:15 +02:00

Use O_CLOEXEC in most places

This commit is contained in:
Eelco Dolstra 2016-06-09 16:15:58 +02:00
parent 9bdd949cfd
commit 202683a4fc
9 changed files with 23 additions and 19 deletions

View file

@ -16,12 +16,10 @@ int openLockFile(const Path & path, bool create)
{
AutoCloseFD fd;
fd = open(path.c_str(), O_RDWR | (create ? O_CREAT : 0), 0600);
fd = open(path.c_str(), O_CLOEXEC | O_RDWR | (create ? O_CREAT : 0), 0600);
if (fd == -1 && (create || errno != ENOENT))
throw SysError(format("opening lock file %1%") % path);
closeOnExec(fd);
return fd.borrow();
}