summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-06-30 09:19:05 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-06-30 09:29:54 +0200
commite6b0ae7a13e20c4361327e50048a5143c8e9941b (patch)
tree79b769e1050ad65cbc31b4ddf8e07b712eaa29c2
parent28f087c8642ff9c8dd6964e101e6d8539db6281a (diff)
downloadlibgit2-e6b0ae7a13e20c4361327e50048a5143c8e9941b.tar.gz
ssl: init only once without threads
The OpenSSL library-loading functions do not expect to be called multiple times. Add a flag in the non-threaded libgit2 init so we only call once. This fixes #2446.
-rw-r--r--src/global.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/global.c b/src/global.c
index 03a4bcedf..c72bfe890 100644
--- a/src/global.c
+++ b/src/global.c
@@ -291,7 +291,13 @@ static git_global_st __state;
int git_threads_init(void)
{
- init_ssl();
+ static int ssl_inited = 0;
+
+ if (!ssl_inited) {
+ init_ssl();
+ ssl_inited = 1;
+ }
+
git_atomic_inc(&git__n_inits);
return 0;
}