Merge pull request #8020 from edolstra/no-such-process
Make findRuntimeRoots() more resilient to disappearing processes
This commit is contained in:
commit
523913d091
|
@ -371,6 +371,7 @@ void LocalStore::findRuntimeRoots(Roots & roots, bool censor)
|
|||
while (errno = 0, ent = readdir(procDir.get())) {
|
||||
checkInterrupt();
|
||||
if (std::regex_match(ent->d_name, digitsRegex)) {
|
||||
try {
|
||||
readProcLink(fmt("/proc/%s/exe" ,ent->d_name), unchecked);
|
||||
readProcLink(fmt("/proc/%s/cwd", ent->d_name), unchecked);
|
||||
|
||||
|
@ -393,7 +394,6 @@ void LocalStore::findRuntimeRoots(Roots & roots, bool censor)
|
|||
}
|
||||
fdDir.reset();
|
||||
|
||||
try {
|
||||
auto mapFile = fmt("/proc/%s/maps", ent->d_name);
|
||||
auto mapLines = tokenizeString<std::vector<std::string>>(readFile(mapFile), "\n");
|
||||
for (const auto & line : mapLines) {
|
||||
|
|
Loading…
Reference in a new issue