summaryrefslogtreecommitdiffstats
path: root/crypto/err
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2006-06-14 08:51:41 +0000
committerBodo Möller <bodo@openssl.org>2006-06-14 08:51:41 +0000
commit6d2cd23f402bf6cca7a29c4a6514012a4779f85c (patch)
tree042114aed264956f3fa7eef7da62b83b37aedfc2 /crypto/err
parent14fb67f28a26a30c5af301aff65c83e20ca986db (diff)
Thread-safety fixes
Diffstat (limited to 'crypto/err')
-rw-r--r--crypto/err/err.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 72e3f3a26c..96bd255e50 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -548,9 +548,20 @@ static void build_SYS_str_reasons(void)
int i;
static int init = 1;
- if (!init) return;
-
+ CRYPTO_r_lock(CRYPTO_LOCK_ERR);
+ if (!init)
+ {
+ CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
+ return;
+ }
+
+ CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
CRYPTO_w_lock(CRYPTO_LOCK_ERR);
+ if (!init)
+ {
+ CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
+ return;
+ }
for (i = 1; i <= NUM_SYS_STR_REASONS; i++)
{