aboutsummaryrefslogtreecommitdiff
path: root/nix/libstore/local-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'nix/libstore/local-store.cc')
-rw-r--r--nix/libstore/local-store.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc
index 11f61ae030..347e8a703f 100644
--- a/nix/libstore/local-store.cc
+++ b/nix/libstore/local-store.cc
@@ -606,10 +606,10 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
users group); we check for this case below. */
if (st.st_uid != geteuid()) {
#if HAVE_LCHOWN
- if (lchown(path.c_str(), geteuid(), (gid_t) -1) == -1)
+ if (lchown(path.c_str(), geteuid(), getegid()) == -1)
#else
if (!S_ISLNK(st.st_mode) &&
- chown(path.c_str(), geteuid(), (gid_t) -1) == -1)
+ chown(path.c_str(), geteuid(), getegid()) == -1)
#endif
throw SysError(format("changing owner of `%1%' to %2%")
% path % geteuid());
@@ -1213,6 +1213,9 @@ template<class T> T LocalStore::getIntLineFromSubstituter(RunningSubstituter & r
PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
{
PathSet res;
+
+ if (!settings.useSubstitutes) return res;
+
foreach (Paths::iterator, i, settings.substituters) {
if (res.size() == paths.size()) break;
RunningSubstituter & run(runningSubstituters[*i]);
@@ -1239,6 +1242,8 @@ PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
void LocalStore::querySubstitutablePathInfos(const Path & substituter,
PathSet & paths, SubstitutablePathInfos & infos)
{
+ if (!settings.useSubstitutes) return;
+
RunningSubstituter & run(runningSubstituters[substituter]);
startSubstituter(substituter, run);
if (run.disabled) return;