summaryrefslogtreecommitdiff
path: root/sysdeps/generic/pt-mutex-init.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/pt-mutex-init.c')
-rw-r--r--sysdeps/generic/pt-mutex-init.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sysdeps/generic/pt-mutex-init.c b/sysdeps/generic/pt-mutex-init.c
index a818fe3..2f96028 100644
--- a/sysdeps/generic/pt-mutex-init.c
+++ b/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;