From f05af6b733bf4635be42570134132d664ca130b2 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sun, 31 Jul 2011 22:40:23 +0000 Subject: 2011-07-31 Joel Sherrill PR 1855/cpukit * posix/src/psignal.c, posix/src/pthread.c, posix/src/pthreadjoin.c: Correct signal processing during pthread_join. We are supposed to unblock the thread waiting on a pthread_join(), dispatch the signal handler, account for it potentially overwriting errno, and then have the thread return to blocking within pthread_join(). --- cpukit/posix/src/psignal.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cpukit/posix/src/psignal.c') diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c index d658274de8..e0e3e86a76 100644 --- a/cpukit/posix/src/psignal.c +++ b/cpukit/posix/src/psignal.c @@ -112,9 +112,16 @@ void _POSIX_signals_Post_switch_extension( POSIX_API_Control *api; int signo; ISR_Level level; + int hold_errno; api = the_thread->API_Extensions[ THREAD_API_POSIX ]; + /* + * We need to ensure that if the signal handler executes a call + * which overwrites the unblocking status, we restore it. + */ + hold_errno = _Thread_Executing->Wait.return_code; + /* * api may be NULL in case of a thread close in progress */ @@ -149,6 +156,8 @@ void _POSIX_signals_Post_switch_extension( _POSIX_signals_Check_signal( api, signo, true ); } } + + _Thread_Executing->Wait.return_code = hold_errno; } /* -- cgit v1.2.3