Merge pull request #3482 from pmiddend/ignore-hidden-files-in-temproots

gc.cc: Ignore hidden files in temproots
This commit is contained in:
Eelco Dolstra 2020-04-09 17:34:18 +02:00 committed by GitHub
commit f46cb682f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -202,6 +202,11 @@ void LocalStore::findTempRoots(FDs & fds, Roots & tempRoots, bool censor)
/* Read the `temproots' directory for per-process temporary root /* Read the `temproots' directory for per-process temporary root
files. */ files. */
for (auto & i : readDirectory(tempRootsDir)) { for (auto & i : readDirectory(tempRootsDir)) {
if (i.name[0] == '.') {
// Ignore hidden files. Some package managers (notably portage) create
// those to keep the directory alive.
continue;
}
Path path = tempRootsDir + "/" + i.name; Path path = tempRootsDir + "/" + i.name;
pid_t pid = std::stoi(i.name); pid_t pid = std::stoi(i.name);