[openssl-commits] [openssl] master update
Rich Salz
rsalz at openssl.org
Fri Aug 18 23:37:47 UTC 2017
The branch master has been updated
via b842fcbb37cf3cded72dd7706abd8d54a10cd508 (commit)
from 10ed1b72391ded9853bec417d4d32bd6ec45f916 (commit)
- Log -----------------------------------------------------------------
commit b842fcbb37cf3cded72dd7706abd8d54a10cd508
Author: Rich Salz <rsalz at openssl.org>
Date: Fri Aug 18 11:47:21 2017 -0400
Put thread-fork-init inside a run-once guard
Thanks to Christian Heimes for pointing this out.
Reviewed-by: Andy Polyakov <appro at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4191)
-----------------------------------------------------------------------
Summary of changes:
crypto/threads_pthread.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c
index e28a202..9644c25 100644
--- a/crypto/threads_pthread.c
+++ b/crypto/threads_pthread.c
@@ -169,11 +169,20 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
return 1;
}
+# ifdef OPENSSL_SYS_UNIX
+static pthread_once_t fork_once_control = PTHREAD_ONCE_INIT;
+
+static void fork_once_func(void)
+{
+ pthread_atfork(OPENSSL_fork_prepare,
+ OPENSSL_fork_parent, OPENSSL_fork_child);
+}
+# endif
+
int openssl_init_fork_handlers(void)
{
# ifdef OPENSSL_SYS_UNIX
- if (pthread_atfork(OPENSSL_fork_prepare,
- OPENSSL_fork_parent, OPENSSL_fork_child) == 0)
+ if (pthread_once(&fork_once_control, fork_once_func) == 0)
return 1;
# endif
return 0;
More information about the openssl-commits
mailing list