libprocessgroup: Don't sleep after last cgroup removal attempt

Currently we sleep for 5ms before decrementing retries for the last
time. This is a waste of time, so bail out of the loop if the last
rmdir attempt fails.

Change-Id: Ia20840d27592b4eb3d9762647b19c111ff94209f
This commit is contained in:
T.J. Mercier 2023-10-06 23:11:09 +00:00
parent 5a2d8514de
commit b02f94490d

View file

@ -219,7 +219,7 @@ static int RemoveProcessGroup(const char* cgroup, uid_t uid, int pid, unsigned i
while (retries--) {
ret = rmdir(uid_pid_path.c_str());
if (!ret || errno != EBUSY) break;
if (!ret || errno != EBUSY || !retries) break;
std::this_thread::sleep_for(5ms);
}