From bd50c01972718167cf86d20dcd9c928b4c3cfbd8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 13 Mar 2012 17:07:49 +0100 Subject: 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. --- src/libstore/gc.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/libstore') 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 FDPtr; typedef list FDs; -- cgit 1.4.1