summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2017-03-28 14:21:38 +0300
committerSergey Kandaurov <pluknet@nginx.com>2017-03-28 14:21:38 +0300
commit9ad18e43ac2c9956399018cbb998337943988333 (patch)
tree5fa775ea2ea833bb65b18714d3eafd3539a784b5 /src/http/ngx_http_core_module.c
parenteb017e75cf1b1d82179935b0e23d0c3451b33a87 (diff)
downloadnginx-9ad18e43ac2c9956399018cbb998337943988333.tar.gz
nginx-9ad18e43ac2c9956399018cbb998337943988333.tar.bz2
Fixed ngx_open_cached_file() error handling.
If of.err is 0, it means that there was a memory allocation error and no further logging and/or processing is needed. The of.failed string can be only accessed if of.err is not 0.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index c3957ba38..292671d13 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1314,6 +1314,11 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
{
+ if (of.err == 0) {
+ ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ return NGX_OK;
+ }
+
if (of.err != NGX_ENOENT
&& of.err != NGX_ENOTDIR
&& of.err != NGX_ENAMETOOLONG)