diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2019-04-04 15:09:10 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2019-04-04 15:09:10 +0000 |
commit | a81f30d0d0c345f986741b8a39e47cdb69609cc9 (patch) | |
tree | 20c2793d8bb86e26f0bd4761dfd2429af10b44ac /lib/libtls | |
parent | f59b0bda0e920e27cd7d221d16a6229c8c859189 (diff) |
Switch to pthread_mutex_init().
While PTHREAD_MUTEX_INITIALIZER can be used on OpenBSD, some other
platforms do not like it.
Noted by bcook@
Diffstat (limited to 'lib/libtls')
-rw-r--r-- | lib/libtls/tls_config.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libtls/tls_config.c b/lib/libtls/tls_config.c index 62361e61224..6a717abd48f 100644 --- a/lib/libtls/tls_config.c +++ b/lib/libtls/tls_config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_config.c,v 1.55 2019/04/01 15:58:02 jsing Exp $ */ +/* $OpenBSD: tls_config.c,v 1.56 2019/04/04 15:09:09 jsing Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -94,13 +94,15 @@ tls_config_new_internal(void) if ((config = calloc(1, sizeof(*config))) == NULL) return (NULL); - if ((config->keypair = tls_keypair_new()) == NULL) + if (pthread_mutex_init(&config->mutex, NULL) != 0) goto err; - config->mutex = PTHREAD_MUTEX_INITIALIZER; config->refcount = 1; config->session_fd = -1; + if ((config->keypair = tls_keypair_new()) == NULL) + goto err; + /* * Default configuration. */ |