mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 14:32:42 +01:00
Move creation of the temp roots file into its own function
This also moves the file handle into its own Sync object so we're not holding the _state while acquiring the file lock. There was no real deadlock risk here since locking a newly created file cannot block, but it's still a bit nicer.
This commit is contained in:
parent
15341334b5
commit
224b56f10e
3 changed files with 41 additions and 29 deletions
|
|
@ -441,9 +441,9 @@ LocalStore::~LocalStore()
|
|||
}
|
||||
|
||||
try {
|
||||
auto state(_state.lock());
|
||||
if (state->fdTempRoots) {
|
||||
state->fdTempRoots = -1;
|
||||
auto fdTempRoots(_fdTempRoots.lock());
|
||||
if (*fdTempRoots) {
|
||||
*fdTempRoots = -1;
|
||||
unlink(fnTempRoots.c_str());
|
||||
}
|
||||
} catch (...) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue