diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2012-03-13T16·07+0100 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2012-03-13T16·07+0100 |
commit | bd50c01972718167cf86d20dcd9c928b4c3cfbd8 (patch) | |
tree | f87b9dc31dc188d8f56e08ea0abf26a3ac7258e8 /src/libstore | |
parent | b461721f17d7104c7ef08a0840d80685b9ae853e (diff) |
Ensure that Perl processes delete their entry in the temproots directory
By moving the destructor object to libstore.so, it's also run when download-using-manifests and nix-prefetch-url exit. This prevents them from cluttering /nix/var/nix/temproots with stale files.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/gc.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index e27c63de26ae..95c7154110b3 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -214,6 +214,18 @@ void removeTempRoots() } +/* Automatically clean up the temporary roots file when we exit. */ +struct RemoveTempRoots +{ + ~RemoveTempRoots() + { + removeTempRoots(); + } +}; + +static RemoveTempRoots autoRemoveTempRoots __attribute__((unused)); + + typedef boost::shared_ptr<AutoCloseFD> FDPtr; typedef list<FDPtr> FDs; |