summaryrefslogtreecommitdiff
path: root/lib/libcrypto/err
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2024-10-11 12:27:25 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2024-10-11 12:27:25 +0000
commitbb1a41a15e7850c398f64c216f25566fefdbc5bd (patch)
treeb375da426b117d2937f45a710e381c0827447899 /lib/libcrypto/err
parent7ce8c30cd00a8d65d4af40865ca07130c666ce17 (diff)
Remove pointless locking from err_build_SYS_str_reasons().
err_build_SYS_str_reasons() is only called during initialisation, under pthread_once(). As such, there is no need to grab CRYPTO_LOCK_ERR or check for reentrant calls. ok tb@
Diffstat (limited to 'lib/libcrypto/err')
-rw-r--r--lib/libcrypto/err/err.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c
index 5f03c4cdb53..d7b1728bacc 100644
--- a/lib/libcrypto/err/err.c
+++ b/lib/libcrypto/err/err.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: err.c,v 1.70 2024/10/11 12:25:05 jsing Exp $ */
+/* $OpenBSD: err.c,v 1.71 2024/10/11 12:27:24 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -487,22 +487,8 @@ err_build_SYS_str_reasons(void)
{
/* malloc cannot be used here, use static storage instead */
static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON];
- int i;
- static int init = 1;
int save_errno;
-
- 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;
- }
+ int i;
/* strerror(3) will set errno to EINVAL when i is an unknown errno. */
save_errno = errno;
@@ -526,10 +512,6 @@ err_build_SYS_str_reasons(void)
/* Now we still have SYS_str_reasons[NUM_SYS_STR_REASONS] = {0, NULL},
* as required by ERR_load_strings. */
-
- init = 0;
-
- CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
}
#endif