Merge pull request #9271 from keszybz/if-fix

fix: gcc complains about if which doesn't guard the indented statement
This commit is contained in:
John Ericson 2023-11-01 14:02:33 -04:00 committed by GitHub
commit 8d66346293
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1563,10 +1563,11 @@ void LocalDerivationGoal::addDependency(const StorePath & path)
Path source = worker.store.Store::toRealPath(path);
Path target = chrootRootDir + worker.store.printStorePath(path);
if (pathExists(target))
if (pathExists(target)) {
// There is a similar debug message in doBind, so only run it in this block to not have double messages.
debug("bind-mounting %s -> %s", target, source);
throw Error("store path '%s' already exists in the sandbox", worker.store.printStorePath(path));
}
/* Bind-mount the path into the sandbox. This requires
entering its mount namespace, which is not possible