summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2004-03-29 13:57:55 +0000
committermtm <mtm@FreeBSD.org>2004-03-29 13:57:55 +0000
commita9677be93b2494b3aff1faea5058e891f1a71955 (patch)
treef769f6e712a5240f63eb8fd52e6340eb8d1ff882 /lib/libthr
parentf4172a5e78559e7f1eb4ea6afdd2937dfc673597 (diff)
downloadFreeBSD-src-a9677be93b2494b3aff1faea5058e891f1a71955.zip
FreeBSD-src-a9677be93b2494b3aff1faea5058e891f1a71955.tar.gz
o Also check that the mutex type is not less than the minimum allowable value.
o Don't check attribute for NULL. It's the callers responsibility.
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_mattr_kind_np.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_mattr_kind_np.c b/lib/libthr/thread/thr_mattr_kind_np.c
index f3d30ff..2b1e8af 100644
--- a/lib/libthr/thread/thr_mattr_kind_np.c
+++ b/lib/libthr/thread/thr_mattr_kind_np.c
@@ -71,9 +71,10 @@ int
_pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
{
int ret;
- if (attr == NULL || *attr == NULL || type >= MUTEX_TYPE_MAX) {
+ if (*attr == NULL || type < PTHREAD_MUTEX_ERRORCHECK ||
+ type >= MUTEX_TYPE_MAX) {
errno = EINVAL;
- ret = -1;
+ ret = EINVAL;
} else {
(*attr)->m_type = type;
ret = 0;
OpenPOWER on IntegriCloud