diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | barrier.c | 16 | ||||
-rw-r--r-- | condvar.c | 3 | ||||
-rw-r--r-- | mutex.c | 8 |
4 files changed, 20 insertions, 17 deletions
@@ -1,9 +1,17 @@ 2001-07-18 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+ Contributed by - "Scott McCaskill" <scott@magruder.org>
+
* mutex.c (pthread_mutexattr_init): Return ENOMEM
immediately and don't dereference the NULL pointer
if calloc fails.
- - "Scott McCaskill" <scott@magruder.org>
+ (pthread_mutexattr_getpshared): Don't dereference
+ a pointer that is possibly NULL.
+ * barrier.c (pthread_barrierattr_init): Likewise
+ (pthread_barrierattr_getpshared): Don't dereference
+ a pointer that is possibly NULL.
+ * condvar.c (pthread_condattr_getpshared): Don't dereference
+ a pointer that is possibly NULL.
2001-07-10 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
@@ -221,13 +221,14 @@ pthread_barrierattr_init (pthread_barrierattr_t * attr) { result = ENOMEM; } - - ba->pshared = PTHREAD_PROCESS_PRIVATE; - + else + { + ba->pshared = PTHREAD_PROCESS_PRIVATE; + } + *attr = ba; - + return (result); - } /* pthread_barrierattr_init */ @@ -270,12 +271,9 @@ pthread_barrierattr_destroy (pthread_barrierattr_t * attr) *attr = NULL; free (ba); - - result = 0; } return (result); - } /* pthread_barrierattr_destroy */ @@ -330,12 +328,10 @@ pthread_barrierattr_getpshared (const pthread_barrierattr_t * attr, } else { - *pshared = PTHREAD_PROCESS_PRIVATE; result = EINVAL; } return (result); - } /* pthread_barrierattr_getpshared */ @@ -338,7 +338,7 @@ pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared) * * RESULTS * 0 successfully retrieved attribute, - * EINVAL 'attr' is invalid, + * EINVAL 'attr' or 'pshared' is invalid, * * ------------------------------------------------------ */ @@ -352,7 +352,6 @@ pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared) } else { - *pshared = PTHREAD_PROCESS_PRIVATE; result = EINVAL; } @@ -290,10 +290,10 @@ pthread_mutexattr_init (pthread_mutexattr_t * attr) { ma->pshared = PTHREAD_PROCESS_PRIVATE; ma->kind = PTHREAD_MUTEX_DEFAULT; - - *attr = ma; } + *attr = ma; + return(result); } /* pthread_mutexattr_init */ @@ -384,16 +384,16 @@ pthread_mutexattr_getpshared (const pthread_mutexattr_t * attr, * ------------------------------------------------------ */ { - int result = 0; + int result; if ((attr != NULL && *attr != NULL) && (pshared != NULL)) { *pshared = (*attr)->pshared; + result = 0; } else { - *pshared = PTHREAD_PROCESS_PRIVATE; result = EINVAL; } |