[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
294/376: Clean up temp roots in a more C++ way
From: |
Ludovic Courtès |
Subject: |
294/376: Clean up temp roots in a more C++ way |
Date: |
Wed, 28 Jan 2015 22:05:43 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 1256ab3b446d8e35225c36e71abb50ee964ea050
Author: Eelco Dolstra <address@hidden>
Date: Wed Nov 19 17:07:29 2014 +0100
Clean up temp roots in a more C++ way
---
src/libstore/gc.cc | 26 --------------------------
src/libstore/local-store.cc | 9 +++++++++
src/libstore/local-store.hh | 4 ++++
3 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index ebee485..0806430 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -145,11 +145,6 @@ Path addPermRoot(StoreAPI & store, const Path & _storePath,
}
-/* The file to which we write our temporary roots. */
-static Path fnTempRoots;
-static AutoCloseFD fdTempRoots;
-
-
void LocalStore::addTempRoot(const Path & path)
{
/* Create the temporary roots file for this process. */
@@ -204,27 +199,6 @@ void LocalStore::addTempRoot(const Path & path)
}
-void removeTempRoots()
-{
- if (fdTempRoots != -1) {
- fdTempRoots.close();
- unlink(fnTempRoots.c_str());
- }
-}
-
-
-/* Automatically clean up the temporary roots file when we exit. */
-struct RemoveTempRoots
-{
- ~RemoveTempRoots()
- {
- removeTempRoots();
- }
-};
-
-static RemoveTempRoots autoRemoveTempRoots __attribute__((unused));
-
-
typedef std::shared_ptr<AutoCloseFD> FDPtr;
typedef list<FDPtr> FDs;
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index f08c877..fc48c04 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -363,6 +363,15 @@ LocalStore::~LocalStore()
} catch (...) {
ignoreException();
}
+
+ try {
+ if (fdTempRoots != -1) {
+ fdTempRoots.close();
+ unlink(fnTempRoots.c_str());
+ }
+ } catch (...) {
+ ignoreException();
+ }
}
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index dccdba5..e0aabdb 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -244,6 +244,10 @@ private:
bool didSetSubstituterEnv;
+ /* The file to which we write our temporary roots. */
+ Path fnTempRoots;
+ AutoCloseFD fdTempRoots;
+
int getSchema();
void openDB(bool create);
- 376/376: Grmbl, (continued)
- 376/376: Grmbl, Ludovic Courtès, 2015/01/28
- 372/376: Merge branch 'cygwin-master' of https://github.com/ternaris/nix, Ludovic Courtès, 2015/01/28
- 364/376: ReiserFS -> ext4, Ludovic Courtès, 2015/01/28
- 375/376: Add a section on nix-serve, Ludovic Courtès, 2015/01/28
- 361/376: Document channel format and excise most mentions of manifests and nix-pull, Ludovic Courtès, 2015/01/28
- 370/376: Delete the stdenv section, Ludovic Courtès, 2015/01/28
- 374/376: Add section on SSH substituter, Ludovic Courtès, 2015/01/28
- 373/376: Pedantry, Ludovic Courtès, 2015/01/28
- 368/376: Fix build, Ludovic Courtès, 2015/01/28
- 369/376: Bla, Ludovic Courtès, 2015/01/28
- 294/376: Clean up temp roots in a more C++ way,
Ludovic Courtès <=
- 287/376: Don't use ADDR_LIMIT_3GB, Ludovic Courtès, 2015/01/28
- 255/376: binary download: Use $NIX_CURL_FLAGS, Ludovic Courtès, 2015/01/28
- 301/376: 'build-cache-failures' -> 'build-cache-failure' in nix.conf documentation., Ludovic Courtès, 2015/01/28
- 275/376: Revert "Revert "Revert "Temporarily disable darwin builds while hydra's darwin is borked""", Ludovic Courtès, 2015/01/28
- 302/376: Don't claim FreeBSD support, Ludovic Courtès, 2015/01/28
- 274/376: Don't pull in git when doing a nix-shell, Ludovic Courtès, 2015/01/28
- 247/376: mkList: Scrub better, Ludovic Courtès, 2015/01/28
- 248/376: Improved error message when encountering unsupported file types, Ludovic Courtès, 2015/01/28
- 295/376: nix-daemon: Call exit(), not _exit(), Ludovic Courtès, 2015/01/28
- 242/376: Add primop ‘attrValues’, Ludovic Courtès, 2015/01/28