comparison src/http/modules/ngx_http_index_module.c @ 6948:3fb9b5eb75c0

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.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 28 Mar 2017 14:21:38 +0300
parents 3d50d86f3572
children e55e28e6998f
comparison
equal deleted inserted replaced
6947:a8d7c9139831 6948:3fb9b5eb75c0
215 } 215 }
216 216
217 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool) 217 if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
218 != NGX_OK) 218 != NGX_OK)
219 { 219 {
220 if (of.err == 0) {
221 return NGX_HTTP_INTERNAL_SERVER_ERROR;
222 }
223
220 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, of.err, 224 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, of.err,
221 "%s \"%s\" failed", of.failed, path.data); 225 "%s \"%s\" failed", of.failed, path.data);
222
223 if (of.err == 0) {
224 return NGX_HTTP_INTERNAL_SERVER_ERROR;
225 }
226 226
227 #if (NGX_HAVE_OPENAT) 227 #if (NGX_HAVE_OPENAT)
228 if (of.err == NGX_EMLINK 228 if (of.err == NGX_EMLINK
229 || of.err == NGX_ELOOP) 229 || of.err == NGX_ELOOP)
230 { 230 {