diff options
author | Russell Belfer <rb@github.com> | 2013-05-31 14:13:11 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-05-31 14:13:11 -0700 |
commit | 1a42dd17eb2c35fa572418f5958595cbe297d229 (patch) | |
tree | f135f3788eb20b5ac100519c41c7525f5f830457 /src/cache.c | |
parent | f658dc433cae351e72b1c8b245724eafb43f5844 (diff) | |
download | libgit2-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/cache.c')
-rw-r--r-- | src/cache.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cache.c b/src/cache.c index 6205ef8a9..afc7c5b3a 100644 --- a/src/cache.c +++ b/src/cache.c @@ -68,7 +68,10 @@ int git_cache_init(git_cache *cache) { memset(cache, 0, sizeof(*cache)); cache->map = git_oidmap_alloc(); - git_mutex_init(&cache->lock); + if (git_mutex_init(&cache->lock)) { + giterr_set(GITERR_OS, "Failed to initialize cache mutex"); + return -1; + } return 0; } |