diff options
Diffstat (limited to 'src/libstore/store.cc')
-rw-r--r-- | src/libstore/store.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc index 110ec2b48556..5b471a1d9cd8 100644 --- a/src/libstore/store.cc +++ b/src/libstore/store.cc @@ -157,7 +157,10 @@ void copyPath(const Path & src, const Path & dst) CopySink sink; sink.fd = pipe.writeSide; - dumpPath(src, sink); + { + SwitchToOriginalUser sw; + dumpPath(src, sink); + } /* Wait for the child to finish. */ int status = pid.wait(true); @@ -421,7 +424,11 @@ Path addToStore(const Path & _srcPath) Path srcPath(absPath(_srcPath)); debug(format("adding `%1%' to the store") % srcPath); - Hash h = hashPath(srcPath); + Hash h; + { + SwitchToOriginalUser sw; + h = hashPath(srcPath); + } string baseName = baseNameOf(srcPath); Path dstPath = canonPath(nixStore + "/" + (string) h + "-" + baseName); |