Merge "Kill its process group even if the given process is already dead" am: 763593e395
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2459289 Change-Id: Icb4b2f94a5ade70ad3ead99a8898cca301dc53b3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
2038ed868b
1 changed files with 9 additions and 12 deletions
|
@ -406,18 +406,15 @@ static int DoKillProcessGroupOnce(const char* cgroup, uid_t uid, int initialPid,
|
|||
pids.emplace(pid);
|
||||
}
|
||||
}
|
||||
if (file_is_empty) {
|
||||
// This happens when process is already dead
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Erase all pids that will be killed when we kill the process groups.
|
||||
for (auto it = pids.begin(); it != pids.end();) {
|
||||
pid_t pgid = getpgid(*it);
|
||||
if (pgids.count(pgid) == 1) {
|
||||
it = pids.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
if (!file_is_empty) {
|
||||
// Erase all pids that will be killed when we kill the process groups.
|
||||
for (auto it = pids.begin(); it != pids.end();) {
|
||||
pid_t pgid = getpgid(*it);
|
||||
if (pgids.count(pgid) == 1) {
|
||||
it = pids.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue