aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2023-01-03 14:51:23 +0100
committerEelco Dolstra <edolstra@gmail.com>2023-01-03 14:51:23 +0100
commit224b56f10e1bb754d403c106eb9d1b947fc30414 (patch)
tree5bc37fcd2349236a71d9f5139bd26ece5580b6a8 /src/libstore/local-store.cc
parent15341334b50b2b432830a8e78abc331d0a47de13 (diff)
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.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 3bab10af9..be21e3ca0 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -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 (...) {