diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-04 23:29:16 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-04 23:29:16 +0000 |
commit | 74033a844fe57e3e91c71ae37f9a65f6b2f22aa9 (patch) | |
tree | b7bc47382b27fc8ca916ca1cbbcc8fe9aa427aaa /src/libstore/gc.cc | |
parent | 0d40f6d7bb226e69f65f8ca8e6d0597baf3eec9a (diff) | |
download | guix-74033a844fe57e3e91c71ae37f9a65f6b2f22aa9.tar.gz |
* Add indirect root registration to the protocol so that unprivileged
processes can register indirect roots. Of course, there is still the problem that the garbage collector can only read the targets of the indirect roots when it's running as root...
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r-- | src/libstore/gc.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 56e64369a7..ba59083cad 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -82,6 +82,15 @@ void LocalStore::syncWithGC() } +void LocalStore::addIndirectRoot(const Path & path) +{ + string hash = printHash32(hashString(htSHA1, path)); + Path realRoot = canonPath((format("%1%/%2%/auto/%3%") + % nixStateDir % gcRootsDir % hash).str()); + createSymlink(realRoot, path, false); +} + + Path addPermRoot(const Path & _storePath, const Path & _gcRoot, bool indirect, bool allowOutsideRootsDir) { @@ -90,12 +99,8 @@ Path addPermRoot(const Path & _storePath, const Path & _gcRoot, assertStorePath(storePath); if (indirect) { - string hash = printHash32(hashString(htSHA1, gcRoot)); - Path realRoot = canonPath((format("%1%/%2%/auto/%3%") - % nixStateDir % gcRootsDir % hash).str()); - createSymlink(gcRoot, storePath, true); - createSymlink(realRoot, gcRoot, false); + store->addIndirectRoot(gcRoot); } else { |