mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
Merge pull request #8020 from edolstra/no-such-process
Make findRuntimeRoots() more resilient to disappearing processes
This commit is contained in:
commit
523913d091
1 changed files with 22 additions and 22 deletions
|
@ -371,6 +371,7 @@ void LocalStore::findRuntimeRoots(Roots & roots, bool censor)
|
||||||
while (errno = 0, ent = readdir(procDir.get())) {
|
while (errno = 0, ent = readdir(procDir.get())) {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
if (std::regex_match(ent->d_name, digitsRegex)) {
|
if (std::regex_match(ent->d_name, digitsRegex)) {
|
||||||
|
try {
|
||||||
readProcLink(fmt("/proc/%s/exe" ,ent->d_name), unchecked);
|
readProcLink(fmt("/proc/%s/exe" ,ent->d_name), unchecked);
|
||||||
readProcLink(fmt("/proc/%s/cwd", 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();
|
fdDir.reset();
|
||||||
|
|
||||||
try {
|
|
||||||
auto mapFile = fmt("/proc/%s/maps", ent->d_name);
|
auto mapFile = fmt("/proc/%s/maps", ent->d_name);
|
||||||
auto mapLines = tokenizeString<std::vector<std::string>>(readFile(mapFile), "\n");
|
auto mapLines = tokenizeString<std::vector<std::string>>(readFile(mapFile), "\n");
|
||||||
for (const auto & line : mapLines) {
|
for (const auto & line : mapLines) {
|
||||||
|
|
Loading…
Reference in a new issue