1
0
Fork 0
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:
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

@ -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();