diff options
Diffstat (limited to 'libpthread/sysdeps/generic/pt-mutex-init.c')
-rw-r--r-- | libpthread/sysdeps/generic/pt-mutex-init.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libpthread/sysdeps/generic/pt-mutex-init.c b/libpthread/sysdeps/generic/pt-mutex-init.c index a818fe3a..2f960286 100644 --- a/libpthread/sysdeps/generic/pt-mutex-init.c +++ b/libpthread/sysdeps/generic/pt-mutex-init.c @@ -35,14 +35,11 @@ _pthread_mutex_init (pthread_mutex_t *mutex, /* The default attributes. */ return 0; - if (attr == &__pthread_recursive_mutexattr) - /* Non-default but known attributes. */ - { - mutex->attr = attr; - return 0; - } - - mutex->attr = malloc (sizeof *attr); + if (! mutex->attr + || mutex->attr == __PTHREAD_ERRORCHECK_MUTEXATTR + || mutex->attr == __PTHREAD_RECURSIVE_MUTEXATTR) + mutex->attr = malloc (sizeof *attr); + if (! mutex->attr) return ENOMEM; |