summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/safestack/safestack.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler-rt/lib/safestack/safestack.cc b/compiler-rt/lib/safestack/safestack.cc
index 673f5fd30c5..e68208015fb 100644
--- a/compiler-rt/lib/safestack/safestack.cc
+++ b/compiler-rt/lib/safestack/safestack.cc
@@ -183,7 +183,10 @@ static void thread_cleanup_handler(void *_iter) {
thread_stack_ll **stackp = &temp_stacks;
while (*stackp) {
thread_stack_ll *stack = *stackp;
- if (stack->pid != pid || TgKill(stack->pid, stack->tid, 0) == -ESRCH) {
+ int error;
+ if (stack->pid != pid ||
+ (internal_iserror(TgKill(stack->pid, stack->tid, 0), &error) &&
+ error == ESRCH)) {
UnmapOrDie(stack->stack_base, stack->size);
*stackp = stack->next;
free(stack);
OpenPOWER on IntegriCloud