diff options
author | jsing <> | 2019-04-04 15:09:09 +0000 |
---|---|---|
committer | jsing <> | 2019-04-04 15:09:09 +0000 |
commit | dd7144d9b81e4d15f6752ff79bd94ff90d2bc9c7 (patch) | |
tree | d9562539be521c80f84c8290fcd9f2b85d4f9b7d | |
parent | 7203e00d6c6fef1960e8a742c0ace7c379b96cde (diff) | |
download | openbsd-dd7144d9b81e4d15f6752ff79bd94ff90d2bc9c7.tar.gz openbsd-dd7144d9b81e4d15f6752ff79bd94ff90d2bc9c7.tar.bz2 openbsd-dd7144d9b81e4d15f6752ff79bd94ff90d2bc9c7.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@
-rw-r--r-- | src/lib/libtls/tls_config.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libtls/tls_config.c b/src/lib/libtls/tls_config.c index 62361e6122..6a717abd48 100644 --- a/src/lib/libtls/tls_config.c +++ b/src/lib/libtls/tls_config.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_config.c,v 1.55 2019/04/01 15:58:02 jsing Exp $ */ | 1 | /* $OpenBSD: tls_config.c,v 1.56 2019/04/04 15:09:09 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -94,13 +94,15 @@ tls_config_new_internal(void) | |||
94 | if ((config = calloc(1, sizeof(*config))) == NULL) | 94 | if ((config = calloc(1, sizeof(*config))) == NULL) |
95 | return (NULL); | 95 | return (NULL); |
96 | 96 | ||
97 | if ((config->keypair = tls_keypair_new()) == NULL) | 97 | if (pthread_mutex_init(&config->mutex, NULL) != 0) |
98 | goto err; | 98 | goto err; |
99 | 99 | ||
100 | config->mutex = PTHREAD_MUTEX_INITIALIZER; | ||
101 | config->refcount = 1; | 100 | config->refcount = 1; |
102 | config->session_fd = -1; | 101 | config->session_fd = -1; |
103 | 102 | ||
103 | if ((config->keypair = tls_keypair_new()) == NULL) | ||
104 | goto err; | ||
105 | |||
104 | /* | 106 | /* |
105 | * Default configuration. | 107 | * Default configuration. |
106 | */ | 108 | */ |