1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-01 14:41:00 +01:00

Fallback to the old mechanism if the gc socket isn’t found

This commit is contained in:
Théophane Hufschmitt 2022-04-11 10:20:36 +02:00
parent 26c802d18c
commit 4d9ca6d09e
2 changed files with 16 additions and 2 deletions

View file

@ -293,9 +293,19 @@ void LocalStore::findRootsNoTemp(Roots & roots, bool censor)
}
Roots LocalStore::findRoots(bool censor)
Roots LocalStore::findRootsNoExternalDaemon(bool censor)
{
Roots roots;
findRootsNoTemp(roots, censor);
FDs fds;
findTempRoots(fds, roots, censor);
return roots;
}
Roots LocalStore::findRoots(bool censor)
{
auto fd = AutoCloseFD(socket(PF_UNIX, SOCK_STREAM
#ifdef SOCK_CLOEXEC
@ -317,7 +327,9 @@ Roots LocalStore::findRoots(bool censor)
strcpy(addr.sun_path, socketPath.c_str());
if (::connect(fd.get(), (struct sockaddr *) &addr, sizeof(addr)) == -1)
throw SysError("cannot connect to the gc daemon at '%1%'", socketPath);
return findRootsNoExternalDaemon(censor);
Roots roots;
try {
while (true) {