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:
parent
9bdd949cfd
commit
202683a4fc
9 changed files with 23 additions and 19 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue