about summary refs log tree commit diff
path: root/src/libstore/gc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r--src/libstore/gc.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index e0de6a968131..e1075d0251fd 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -87,8 +87,11 @@ Path addPermRoot(const Path & _storePath, const Path & _gcRoot,
         string hash = printHash32(hashString(htSHA1, gcRoot));
         Path realRoot = canonPath((format("%1%/%2%/auto/%3%")
             % nixStateDir % gcRootsDir % hash).str());
-
-        createSymlink(gcRoot, storePath, true);
+        
+        {
+            SwitchToOriginalUser sw;
+            createSymlink(gcRoot, storePath, true);
+        }
         createSymlink(realRoot, gcRoot, false);
     }