static int check_threads(int own_tid) noexcept
{
+ int ret = 0;
for (unsigned i = 0; i < 10; ++i) {
- auto ret = get_alive_threads(own_tid);
+ ret = get_alive_threads(own_tid);
if (ret == 0)
break;
/*
- * This may happen if a thread disappears, an entry is removed from /proc and fstatat
+ * This may happen if a thread disappears, an entry is removed from /proc and getdents64
* fails.
*/
- if (i == 9)
- return ret;
}
- return 0;
+ return ret;
}
static bool no_new_threads() noexcept
static int signal_and_wait_for_handlers(pid_t own_pid, int own_tid) noexcept
{
- // No allocations allowed in this function
- int ret = 0;
+ // No allocations allowed in this function
+ int ret = 0;
int time_left = MAX_SIG_WAIT_TIME;
do {
ret = check_threads(own_tid);
for (int i = 0; i < g_managed_tids_num; ++i) {
if (!g_thread_alive[i])
- break;
+ continue;
if (!g_thread_signaled[i]) {
g_thread_signaled[i] = true;
if (time_left == 0)
return ETIME;
- } while (1);
+ } while (true);
return ret;
}
return SECURITY_MANAGER_ERROR_MEMORY;
}
- auto deleter = [&](gid_t* ptr){free(ptr);};
+ auto deleter = [&](gid_t* ptr){free(ptr);};
std::unique_ptr<gid_t, decltype(deleter)> scopedGidBuffer(grp, deleter);
ret = getgroups(NGROUPS_MAX + 1, grp);