summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2019-04-04 15:09:09 +0000
committerjsing <>2019-04-04 15:09:09 +0000
commitd78a2d21e1c60e919ea9d18b07218205a8401e80 (patch)
treed9562539be521c80f84c8290fcd9f2b85d4f9b7d
parent9d8674ce86c9e527155f720e01047aa6047f0fb7 (diff)
downloadopenbsd-d78a2d21e1c60e919ea9d18b07218205a8401e80.tar.gz
openbsd-d78a2d21e1c60e919ea9d18b07218205a8401e80.tar.bz2
openbsd-d78a2d21e1c60e919ea9d18b07218205a8401e80.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.c8
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 */