diff options
author | Carlos MartÃn Nieto <cmn@dwim.me> | 2014-06-30 09:19:05 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2014-08-05 02:06:14 +0200 |
commit | 1d430056f4817f48b0cf212a3aa27f8e26a7a7c2 (patch) | |
tree | 175868bff3e8eda46b1b65d76aab44892e8db0b6 | |
parent | 583833879463d520ccfbdfbf12d4dd69343c01bb (diff) | |
download | libgit2-1d430056f4817f48b0cf212a3aa27f8e26a7a7c2.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.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/global.c b/src/global.c index 03a4bced..c72bfe89 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; } |