From 3b3d1489e409d451b4e7ffabd706d0205f400def Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 1 Sep 2015 14:16:48 +0200 Subject: posix: glibc compatibility --- cpukit/posix/src/setcancelstate.c | 7 +++---- cpukit/posix/src/setcanceltype.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'cpukit/posix') diff --git a/cpukit/posix/src/setcancelstate.c b/cpukit/posix/src/setcancelstate.c index 0ae7339e46..a451c2c4b4 100644 --- a/cpukit/posix/src/setcancelstate.c +++ b/cpukit/posix/src/setcancelstate.c @@ -50,9 +50,6 @@ int pthread_setcancelstate( if ( _ISR_Is_in_progress() ) return EPROTO; - if ( !oldstate ) - return EINVAL; - if ( state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE ) return EINVAL; @@ -61,7 +58,9 @@ int pthread_setcancelstate( executing = _Thread_Executing; thread_support = executing ->API_Extensions[ THREAD_API_POSIX ]; - *oldstate = thread_support->cancelability_state; + if (oldstate != NULL) + *oldstate = thread_support->cancelability_state; + thread_support->cancelability_state = state; _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing ); diff --git a/cpukit/posix/src/setcanceltype.c b/cpukit/posix/src/setcanceltype.c index 2ad7cc900e..8c4687a981 100644 --- a/cpukit/posix/src/setcanceltype.c +++ b/cpukit/posix/src/setcanceltype.c @@ -50,9 +50,6 @@ int pthread_setcanceltype( if ( _ISR_Is_in_progress() ) return EPROTO; - if ( !oldtype ) - return EINVAL; - if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS ) return EINVAL; @@ -61,7 +58,9 @@ int pthread_setcanceltype( executing = _Thread_Executing; thread_support = executing ->API_Extensions[ THREAD_API_POSIX ]; - *oldtype = thread_support->cancelability_type; + if ( oldtype != NULL ) + *oldtype = thread_support->cancelability_type; + thread_support->cancelability_type = type; _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing ); -- cgit v1.2.3