You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
980 B

commit 68c23dedaaae8f29d26c4791b30d138ed1411548
Author: Frédéric Lécaille <flecaille@haproxy.com>
Date: Thu Oct 25 20:18:59 2018 +0200
BUG/MINOR: cache: Wrong usage of shctx_init().
With this patch we check that shctx_init() does not returns 0.
This is possible if the maxblocks argument, which is passed as an
int, is negative due to an implicit conversion.
Must be backported to 1.8.
(cherry picked from commit bc584494e625983f16f35982aa6dd6889e8dd222)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/cache.c b/src/cache.c
index df3649ea..667cede3 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -837,7 +837,7 @@ int cfg_post_parse_section_cache()
ret_shctx = shctx_init(&shctx, tmp_cache_config->maxblocks, CACHE_BLOCKSIZE, sizeof(struct cache), 1);
- if (ret_shctx < 0) {
+ if (ret_shctx <= 0) {
if (ret_shctx == SHCTX_E_INIT_LOCK)
ha_alert("Unable to initialize the lock for the cache.\n");
else