From 1f1e6f30a31f5b647dda66366dabf1c4ae99b918 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 5 Jun 2008 01:57:49 +0000 Subject: [PATCH] Fix recursive mutex bug git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@770 42af7a65-404d-4744-a932-0658087f49c3 --- sched/pthread_mutexattrsettype.c | 2 +- sched/pthread_mutexattrverifytype.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sched/pthread_mutexattrsettype.c b/sched/pthread_mutexattrsettype.c index c50316c3c7..150fc7c4ff 100644 --- a/sched/pthread_mutexattrsettype.c +++ b/sched/pthread_mutexattrsettype.c @@ -92,7 +92,7 @@ int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) if (attr && pthread_mutexattr_verifytype(type) == OK) { attr->type = type; - return 0; + return OK; } return EINVAL; } diff --git a/sched/pthread_mutexattrverifytype.c b/sched/pthread_mutexattrverifytype.c index e089be0885..a172cb8260 100644 --- a/sched/pthread_mutexattrverifytype.c +++ b/sched/pthread_mutexattrverifytype.c @@ -89,7 +89,14 @@ int pthread_mutexattr_verifytype(int type) { /* The depends on the value assigments in pthread.h */ - return (type >= PTHREAD_MUTEX_NORMAL && type <= PTHREAD_MUTEX_RECURSIVE); + if (type >= PTHREAD_MUTEX_NORMAL && type <= PTHREAD_MUTEX_RECURSIVE) + { + return OK; + } + else + { + return ERROR; + } } #endif /* CONFIG_MUTEX_TYPES */