From e10f432b1da6d18b793a80f62637b7cf8e637f43 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 20 Feb 2012 21:58:21 +0400 Subject: [PATCH] Check pthread_atfork result (POSIX threads) * pthread_support.c (GC_thr_init): Abort on pthread_atfork failure (only if HANDLE_FORK). --- pthread_support.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pthread_support.c b/pthread_support.c index 75b6e76c..9a9c9d34 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -979,8 +979,9 @@ GC_INNER void GC_thr_init(void) GC_ASSERT((word)&GC_threads % sizeof(word) == 0); # ifdef HANDLE_FORK /* Prepare for a possible fork. */ - pthread_atfork(GC_fork_prepare_proc, GC_fork_parent_proc, - GC_fork_child_proc); + if (pthread_atfork(GC_fork_prepare_proc, GC_fork_parent_proc, + GC_fork_child_proc) != 0) + ABORT("pthread_atfork failed"); # endif # ifdef INCLUDE_LINUX_THREAD_DESCR /* Explicitly register the region including the address */ -- 2.40.0