summaryrefslogtreecommitdiff
path: root/src/global.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-05-31 14:13:11 -0700
committerRussell Belfer <rb@github.com>2013-05-31 14:13:11 -0700
commit1a42dd17eb2c35fa572418f5958595cbe297d229 (patch)
treef135f3788eb20b5ac100519c41c7525f5f830457 /src/global.c
parentf658dc433cae351e72b1c8b245724eafb43f5844 (diff)
downloadlibgit2-1a42dd17eb2c35fa572418f5958595cbe297d229.tar.gz
Mutex init can fail
It is obviously quite a serious problem if this happens, but mutex initialization can fail and we should detect it. It's a bit like a memory allocation failure, in that you're probably pretty screwed if this occurs, but at least we'll catch it.
Diffstat (limited to 'src/global.c')
-rw-r--r--src/global.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/global.c b/src/global.c
index a0571d127..2d40ca2fc 100644
--- a/src/global.c
+++ b/src/global.c
@@ -61,7 +61,8 @@ int git_threads_init(void)
return 0;
_tls_index = TlsAlloc();
- git_mutex_init(&git__mwindow_mutex);
+ if (git_mutex_init(&git__mwindow_mutex))
+ return -1;
/* Initialize any other subsystems that have global state */
if ((error = git_hash_global_init()) >= 0)
@@ -121,7 +122,8 @@ int git_threads_init(void)
if (_tls_init)
return 0;
- git_mutex_init(&git__mwindow_mutex);
+ if (git_mutex_init(&git__mwindow_mutex))
+ return -1;
pthread_key_create(&_tls_key, &cb__free_status);
/* Initialize any other subsystems that have global state */