diff options
author | jsing <jsing@openbsd.org> | 2019-04-04 15:09:09 +0000 |
---|---|---|
committer | jsing <jsing@openbsd.org> | 2019-04-04 15:09:09 +0000 |
commit | d7e2296c04e87bf1049c0b96cf8bdfcda090c75b (patch) | |
tree | a8eab08f313be992b65567c4c564aa0c88ee93f5 /lib/libtls | |
parent | Sync. (diff) | |
download | wireguard-openbsd-d7e2296c04e87bf1049c0b96cf8bdfcda090c75b.tar.xz wireguard-openbsd-d7e2296c04e87bf1049c0b96cf8bdfcda090c75b.zip |
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. */ |