diff --git a/util/process_map.cpp b/util/process_map.cpp index d6b88e0005d363cf8709ea3fa6ee6836c893f5f0..89938b532dd33e2494eaed26db6d5cd62eb6bd96 100644 --- a/util/process_map.cpp +++ b/util/process_map.cpp @@ -120,6 +120,11 @@ static int GetTgid(pid_t pid) return -1; } statusFile >> token; + if (statusFile.bad()) { + // The file may be successfully opened before while loop, + // but disappear before reading stream. + return -1; + } if (token == "Tgid:") { foundTgid = true; continue;