summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/setcanceltype.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/posix/src/setcanceltype.c')
-rw-r--r--cpukit/posix/src/setcanceltype.c7
1 files changed, 3 insertions, 4 deletions
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 );