diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c index b32f0f0..dbeb39d 100644 --- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c @@ -145,23 +145,27 @@ } if (rc == NGX_CONF_BLOCK_DONE) { + if (!block) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\""); goto failed; } - block = 0; - } - - if (rc == NGX_CONF_FILE_DONE && block) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "unexpected end of file, expecting \"}\""); - goto failed; - } - - if (rc != NGX_OK && rc != NGX_CONF_BLOCK_START) { goto done; } + + if (rc == NGX_CONF_FILE_DONE) { + + if (block) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "unexpected end of file, expecting \"}\""); + goto failed; + } + + goto done; + } + + /* rc == NGX_OK || rc == NGX_CONF_BLOCK_START */ if (cf->handler) {