aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_file_cache.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2018-10-31 16:49:40 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2018-10-31 16:49:40 +0300
commitb66ee453cc6bc1832c3f056c9a46240bd390617c (patch)
tree08dce4e800e306760832c90d7a3b165dfc13fe9d /src/http/ngx_http_file_cache.c
parentf186a01901fbfe425873a3751f84899df4e28804 (diff)
downloadnginx-b66ee453cc6bc1832c3f056c9a46240bd390617c.tar.gz
nginx-b66ee453cc6bc1832c3f056c9a46240bd390617c.zip
Cache: improved keys zone size error reporting.
After this change, too small keys zones are explicitly reported as such, much like in the other modules which use shared memory.
Diffstat (limited to 'src/http/ngx_http_file_cache.c')
-rw-r--r--src/http/ngx_http_file_cache.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
index 2cf1ce4a9..ecdf11e28 100644
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -2418,23 +2418,32 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
p = (u_char *) ngx_strchr(name.data, ':');
- if (p) {
- name.len = p - name.data;
+ if (p == NULL) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid keys zone size \"%V\"", &value[i]);
+ return NGX_CONF_ERROR;
+ }
- p++;
+ name.len = p - name.data;
- s.len = value[i].data + value[i].len - p;
- s.data = p;
+ s.data = p + 1;
+ s.len = value[i].data + value[i].len - s.data;
- size = ngx_parse_size(&s);
- if (size >= (ssize_t) (2 * ngx_pagesize)) {
- continue;
- }
+ size = ngx_parse_size(&s);
+
+ if (size == NGX_ERROR) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid keys zone size \"%V\"", &value[i]);
+ return NGX_CONF_ERROR;
}
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid keys zone size \"%V\"", &value[i]);
- return NGX_CONF_ERROR;
+ if (size < (ssize_t) (2 * ngx_pagesize)) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "keys zone \"%V\" is too small", &value[i]);
+ return NGX_CONF_ERROR;
+ }
+
+ continue;
}
if (ngx_strncmp(value[i].data, "inactive=", 9) == 0) {