Bug fix, kill_process() modifies the id <-> pid maps so to kill all ids one by one the loop iterator must be advanced before the kill.

This commit is contained in:
Stephen Atherton 2018-11-08 16:21:50 -08:00
parent 30b16917ff
commit 3bd66217c6
1 changed files with 5 additions and 2 deletions

View File

@ -1375,8 +1375,11 @@ int main(int argc, char** argv) {
}
else {
/* Otherwise kill each process individually but don't wait on them yet */
for(auto i : id_pid) {
kill_process(i.first, false);
auto i = id_pid.begin();
auto iEnd = id_pid.end();
while(i != iEnd) {
// Must advance i before calling kill_process() which erases the entry at i
kill_process((i++)->first, false);
}
}