mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +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
|
@ -509,10 +509,9 @@ void UserLock::acquire()
|
|||
/* We already have a lock on this one. */
|
||||
continue;
|
||||
|
||||
AutoCloseFD fd = open(fnUserLock.c_str(), O_RDWR | O_CREAT, 0600);
|
||||
AutoCloseFD fd = open(fnUserLock.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0600);
|
||||
if (fd == -1)
|
||||
throw SysError(format("opening user lock ‘%1%’") % fnUserLock);
|
||||
closeOnExec(fd);
|
||||
|
||||
if (lockFile(fd, ltWrite, false)) {
|
||||
fdUserLock = fd.borrow();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue